对拍+一组数据
查看原帖
对拍+一组数据
1223032
Szymogu楼主2025/2/8 13:43

一组数据

7 7 1
6 0
0 2 10
2 4 5
2 3 66
3 6 89
4 1 27
1 5 5
5 6 100

data.cpp

#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<bitset>
#include<ctime>
using namespace std;
int main() {
	srand(time(0));
	ios::sync_with_stdio(0);
	int n = rand()%10+5, m = rand() % 50 + 15, k = rand() % 5;
	cout << n << ' ' << m << ' ' << k << '\n';
	int s = rand() % n, t = rand() % n;
	while (t == s) {
		t = rand() % n;
	}
	cout << s << ' ' << t << '\n';
	for (int i = 0;i < n-1;i++) {
		cout << i << ' ' << i + 1 << ' ' << 100<<'\n';
	}
	for (int i = 1;i <= m-n+1;i++) {
		int a = rand() % n, b = rand() % n, c = rand() % 100;
		cout << a << ' ' << b << ' ' << c<<'\n';
	}cout << '\n';
	return 0;
}

duipai.cpp

#include<cstdio>
#include<cstdlib>
#include<ctime>

int main()
{
    long s, t;
    while (1) {
        system("cls");
        do {
            system("data.exe > try.in"); //data是数据生成程序
            s = clock();
            system("a.exe < try.in > try1.out");  //a是要交的程序
            t = clock();
            system("b.exe < try.in > try2.out");  //b是正确的程序
            if (system("fc try1.out try2.out > nul"))
                break;
            //else printf("AC time: %ldms\n",t-s);//如果需要看可以取消注释
        } while (1);
        printf("WA time: %ldms\n", t - s);  //运行时间 
        system("fc try1.out try2.out");
        system("pause>nul");
    }
    return 0;
}

对拍程序是之前在讨论区偷的,我仅提供了本题的数据生成程序,不会用的话自己查一下吧(逃

2025/2/8 13:43
加载中...