对拍

chinaxjh

2019-11-13 18:59:50

Personal

建联通的树 ```cpp #include<bits/stdc++.h> using namespace std; const int n=6;//可以更改,下同 const int m=15;// pair<int,int> e[100005]; map< pair<int,int>,bool > h; int i; int random(int x) { return rand()*rand()%x; } int main() { srand((unsigned)time(0)); freopen("data.in","w",stdout); cout<<n<<' '<<m<<endl; for (i=1;i<n;i++) { int fa=random(i)+1; e[i]=make_pair(fa,i+1); h[e[i]]=h[make_pair(i+1,fa)]=1; } for (i=n;i<=m;i++) { int x,y; do { x=random(n)+1; y=random(n)+1; } while(x==y||h[make_pair(x,y)]); e[i]=make_pair(x,y); h[e[i]]=h[make_pair(y,x)]=1; } random_shuffle(e+1,e+m+1); for (i=1;i<=m;i++) printf("%d %d %d\n",e[i].first,e[i].second,random(20000)+1); cout<<m<<endl; for (i=1;i<=m;i++) { int x,y; x=random(n)+1; do { y=random(n)+1; } while(x==y); printf("%d %d\n",x,y); } } ``` 对拍程序 ```cpp #include<bits/stdc++.h> using namespace std; int main() { for (int T=1;T<=10000;T++) { system("data.exe"); double s=clock(); system("sol.exe"); double o=clock(); system("bf.exe"); if (system("fc bf.out sol.out")) { puts("Wa"); return 0; } else printf("AC Round#%d time %.01f ms\n",T,o-s); } } ```