杰斯对拍&数据生成器
树生成器
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9;
const int N=1e6+5;
int n,m=10;
int d[N],p[N];
vector<pair<int,int>> a;
int main(){
// freopen("in","w",stdout);
n=10;
mt19937 rnd(time(0));
for(int i=1;i<=n;++i){
d[i]=1;
}
for(int i=1;i<=n-2;++i){
++d[p[i]=rnd()%n+1];
}
int now,pre;
for(int i=1;i<=n;++i){
if(d[i]==1){
pre=now=i;
break;
}
}
for(int i=1;i<=n-2;++i){
int f=p[i];
a.push_back({now,f});
if(--d[f]==1&&f<pre){
now=f;
}
else{
while(d[++pre]!=1);
now=pre;
}
}
a.push_back({now,n});
for(int i=0;i<a.size();i++){
cout<<a[i].first<<" "<<a[i].second<<endl;
}
return 0;
}
对拍
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int main(){
int t=10;
clock_t startTime,endTime;
while(t--){
system("data.exe > data.txt");
system("test.exe < data.txt > test.txt");
startTime = clock();
system("std.exe < data.txt > std.txt");
endTime = clock();
if(system("fc std.txt test.txt")){
cout<<"Wrong Answer"<<endl;
break;
}
else{
cout<<"Accepted"<<endl;
}
cout<<"The run time is: "<<(double)(endTime-startTime)/CLOCKS_PER_SEC<<"s"<< endl;
}
if(t==0) cout<<"no error"<<endl;
else cout<<"error"<<endl;
return 0;
}