Open GEJXD opened 9 months ago
我写了一个这样的数据生成器:
from cyaron import * test_data = IO(file_prefix="small", data_id=1) n = randint(1, 4000) test_data.input_writeln(n) a = Vector.random(n, [(0, 1000)]) test_data.input_writeln(a) b = Vector.random(n, [(0, 1000)]) test_data.input_writeln(b) k = randint(1, 1000000) test_data.input_writeln(k) test_data.output_gen("./std")
然后把生成出来的数据文件用main.cpp(不是std)读取:
#include<bits/stdc++.h> using i64 = long long; void solve(){ int n; std::cin >> n; std::cout << "n = " << n << '\n'; i64 suma = 0; std::vector<int> a(n + 1); for (int i = 1;i <= n;i ++) { std::cin >> a[i]; suma += a[i]; } std::cout << "A: " << '\n'; for (int i = 1;i <= n;i ++) { std::cout << a[i] << " \n"[i == n]; } i64 sumb = 0; std::vector<int> b(n + 1); for (int i = 1;i <= n;i ++) { std::cin >> b[i]; sumb += b[i]; } std::cout << "B: " << '\n'; for (int i = 1;i <= n;i ++) { std::cout << b[i] << " \n"[i == n]; } int k; std::cin >> k; std::cout << "k = " << k << '\n'; } int main(){ freopen("in.txt","r",stdin); freopen("out.txt","w",stdout); int tt = 1; //cin >> tt; while(tt --) solve(); fclose(stdin); fclose(stdout); return 0; }
但是他的输出是这个样子的:
其中的最后一个数字非0数字98223刚好是用cyaron生成的k值,所以我推测是Vector.random生成的数字数量不够,导致文件读入到了EOF,于是后面的数据都读成了0。
经过测试,n < 1000的规模生成的vector是没问题的,在大于1000左右的时候就会出现这种情况
是的, 这个vector有问题。
see: https://github.com/luogu-dev/cyaron/issues/109
我写了一个这样的数据生成器:
然后把生成出来的数据文件用main.cpp(不是std)读取:
但是他的输出是这个样子的:![image](https://github.com/luogu-dev/cyaron/assets/99662189/5e928631-8e95-4d2e-8f75-a4b5c5a7c897)
其中的最后一个数字非0数字98223刚好是用cyaron生成的k值,所以我推测是Vector.random生成的数字数量不够,导致文件读入到了EOF,于是后面的数据都读成了0。![image](https://github.com/luogu-dev/cyaron/assets/99662189/a83a9cd1-578b-4d11-8b29-a92953028bd6)
经过测试,n < 1000的规模生成的vector是没问题的,在大于1000左右的时候就会出现这种情况