跳到正文

个人记录

模版记录

Rice_Demon_King约 7 分钟
原文

这是 2026年4月22日 存档的第 1 版,不是当前版本。查看当前版本

文章信息与版本

文章信息

发布
2026年4月21日
收录
2026年4月22日
更新
2026年11月8日
篇幅
约 7 分钟
获赞
1

版本

  1. v4当前
  2. v3
  3. v2
  4. v1

*:focus, *:hover { outline: none !important; box-shadow: none !important; }

对拍

C++
#include<bits/stdc++.h>
#include<windows.h>
#define For(i,j,k) for(int i=j;i<=k;i++)
#define dFor(i,j,k) for(int i=j;i>=k;i--)
#define FIO(s) freopen(s".in","r",stdin);freopen(s".out","w",stdout);
#define int long long
const int inf=1e18;
const int Mmod=1e9+7;
const int MAXN=200005;
using namespace std;
namespace DEBUG{
  	template<class T> void _debug(const char *s, T x) {cout<<s<<'='<<x<<endl;}
  	template<class F, class... Nxt> void _debug(const char *s, F x, Nxt... nxt){
  		int d=0;
  		while(*s!=',' || d) d+=*s=='(', d-=*s==')', cout<<*s++;
    	cout<<'='<<x<<',';
    	_debug(s+1, nxt...);
  }
  #define debug(...) _debug(#__VA_ARGS__, __VA_ARGS__)
}
using namespace DEBUG;
double MAX_TIME;
int TEST;
bool SpecialJudge;
signed main(){
	MAX_TIME=1.0,TEST=100000,SpecialJudge=false;
    double Time,mxTime=0;clock_t ST,ED;
    For(sib,1,TEST){
    	printf("第 %d 组数据\n",sib);
		system("make.exe>make.in");
		printf("bl is running...\n");
		system("bl.exe<make.in>bl.out");
		printf("std is running...\n");
		ST=clock();
		system("std.exe<make.in>std.out");
		ED=clock(),Time=double(ED-ST)/CLOCKS_PER_SEC;
		printf("用时: %lf秒\n",Time);
		mxTime=max(mxTime,Time);
		if(Time>MAX_TIME){
			printf("TLE on #%d!!!!!\n",sib);
			Sleep(1000);
			system("start make.in");
			break;
		}
		if(SpecialJudge==true){
			system("spj.exe");
			if(system("fc bl.out spj.out")){
				printf("WA on #%d!!!!!\n",sib);
				Sleep(1000);
				system("start make.in");
				break;
			}
		}
		else{
			if(system("fc bl.out std.out")){
				printf("WA on #%d!!!!!\n",sib);
				Sleep(1000);
				system("start make.in");
				break;
			}
		}
		
	}
	printf("最大用时: %lf",mxTime);
	return 0;
}

对拍样例

C++
#include<bits/stdc++.h>
#include<windows.h>
#define For(i,j,k) for(int i=j;i<=k;i++)
#define dFor(i,j,k) for(int i=j;i>=k;i--)
#define FIO(s) freopen(s".in","r",stdin);freopen(s".out","w",stdout);
#define int long long
const int inf=1e18;
const int Mmod=1e9+7;
const int MAXN=200005;
using namespace std;
namespace DEBUG{
  	template<class T> void _debug(const char *s, T x) {cout<<s<<'='<<x<<endl;}
  	template<class F, class... Nxt> void _debug(const char *s, F x, Nxt... nxt){
  		int d=0;
  		while(*s!=',' || d) d+=*s=='(', d-=*s==')', cout<<*s++;
    	cout<<'='<<x<<',';
    	_debug(s+1, nxt...);
  }
  #define debug(...) _debug(#__VA_ARGS__, __VA_ARGS__)
}
using namespace DEBUG;
inline int SYSTEM(string s){const char* ptr=s.c_str();return system(ptr);}
string File;double Time,mxTime;clock_t ST,ED;
signed main(){
	//std记得删用时!
	int TEST=4;		//测试组数
	double MAX_TIME=1.0;	//时间限制
	string file="ex_detect";	//文件英文名称
	string op=".out";	//输出文件类型
    For(sib,2,TEST){
    	File=file+to_string(sib);
    	printf("第 %d 组数据\n",sib);
		ST=clock();
		SYSTEM("std.exe<"+File+".in>std"+op);
		ED=clock(),Time=double(ED-ST)/CLOCKS_PER_SEC;
		printf("用时: %lf秒\n",Time);
		mxTime=max(mxTime,Time);
		if(SYSTEM("fc "+File+op+" std"+op)){
			printf("WA on #%d!!!!!\n",sib);
			printf("最大用时: %lf",mxTime);
			Sleep(1000);
			SYSTEM("start "+File+".in");
			return 0;
		}
		if(Time>MAX_TIME){
			printf("TLE on #%d!!!!!\n",sib);
			printf("最大用时: %lf",mxTime);
			Sleep(1000);
			SYSTEM("start "+File+".in");
			return 0;
		}
	}
	puts("AC!!!!!!");
	Sleep(1000);
	printf("最大用时: %lf",mxTime);
	return 0;
}

To be continued…