对拍模版(这些代码要在一个文件夹里)对拍时运行最后一个代码,运行后列表为这样

此代码用于填写暴力代码,答案一定要对
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
signed main(){
freopen("data.txt","r",stdin);
freopen("AC.txt","w",stdout);
//暴力代码
return 0;
}
此代码用于填写错误代码
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
signed main(){
freopen("data.txt","r",stdin);
freopen("WA.txt","w",stdout);
//有错的代码
return 0;
}
此代码用于生成随机数据
#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
void initrandomseed(){
srand(time(0));
}
int generaterandomnumber(int l,int r){
//生成随机数的函数,l和r分别表示生成的数的上限和下限
if(l>r){
std::swap(l,r);
}
return l+std::rand()%(r-l+1);
}
int main(){
freopen("data.txt","w",stdout);
initrandomseed();
//根据数据格式自行编写
return 0;
}
此代码用于进行数据比较,运行完后会生成每一个样例是否通过
#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
string a[11];
int main(){
system("g++ AC.cpp -o AC.exe");
system("g++ WA.cpp -o WA.exe");
system("g++ data.cpp -o data.exe");
int cnt=10;
for(int i=1;i<=10;i++){
system("data.exe");
system("AC.exe");
system("WA.exe");
if(!system("fc AC.txt WA.txt")){
a[i]="AC";
}else{
a[i]="WA";
}
//Sleep(400);
system("cls");
}
for(int i=1;i<=10;i++) cout<<i<<". "<<a[i]<<"\n";
return 0;
}