PI - 对拍器
对拍一般需要四个程序
- 对拍器 PI.exe
- 数据生成器 data.exe
- 标程 std.exe
- 需要测试的程序 test.exe
其中只有对拍器是不变的,其余都是因题而异的。
注:以下均用标准输入输出。
平时
#include<bits/stdc++.h>
#include<windows.h>
#define LL long long
using namespace std;
LL s,t;
int sum;
int main()
{
	system("taskkill /f /im data.exe");
	system("taskkill /f /im std.exe");
	system("taskkill /f /im test.exe");
	system("cls");
    for(LL i=1;i>0;i++) {
		if(i%100==0) system("cls"),printf("AC times %lld\n",i);      
        system("data.exe > data.txt");
        
        system("std.exe < data.txt > std.txt");
        s=clock();
        system("test.exe < data.txt > test.txt");
        t=clock();
        printf("#test<%lld>     ",i);
        if(system("fc std.txt test.txt > nul")) {
        	printf("WA        %lldms\n",t-s);
        	system("fc std.txt test.txt");
        	system("pause > nul");
		}
        else if(t-s>1000) {
            printf("TLE       %lldms\n",t-s);
            system("pause > nul");
		}
        else printf("AC        %lldms\n",t-s);
    }
    return 0;
}
考场
#include<bits/stdc++.h>
#include<windows.h>
#define LL long long
using namespace std;
LL s,t;
int sum;
int main()
{
	system("taskkill /f /im data.exe");
	system("taskkill /f /im std.exe");
	system("taskkill /f /im test.exe");
	system("cls");
    for(LL i=1;i>0;i++) {
        system("data.exe > data.txt");
        system("std.exe < data.txt > std.txt");
        s=clock();
        system("test.exe < data.txt > test.txt");
        t=clock();
        if(system("fc std.txt test.txt")) {
        	system("pause > nul");
		}
        else if(t-s>1000) {
            printf("TLE       %lldms\n",t-s);
            system("pause > nul");
		}
        else printf("AC        %lldms\n",t-s);
    }
    return 0;
}
也许用.bat 会更好一些。
 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号