[技巧] Linux 对拍

造数据

#include <bits/stdc++.h>
using namespace std;
int random(int l, int r) {
	return (long long)rand() * rand() % (r - l + 1) + l;
}
int main() {
	freopen("in.in", "w", stdout);
	srand(time(0));
	int n = random(2, 100000);
	cout << n << endl;
	for (int i = 1; i <= n; i++) {
		cout << random(0, 1000000000) << ' ';
	}
	return 0;
}

对拍

#include <bits/stdc++.h>
using namespace std;
int main() {
	system("g++ PEP.cpp -o PEP");
	system("g++ PPEPP.cpp -o PPEPP");
	system("g++ data.cpp -o data");
	while(1) {
		system("./data");
		system("./PEP");
		system("./PPEPP");
		if (system("diff zhengjie.out baoli.out -Z")) {
			cout << "Wrong Answer" << endl;
			break;
		}
		cout << "Accpted" << endl;
	}
	return 0;
}

image

posted @ 2024-07-23 21:48  Peppa_Even_Pig  阅读(30)  评论(0)    收藏  举报