对拍

makedata.cpp

 1 #include <bits/stdc++.h>
 2 
 3 int main() {
 4     int n = rand()%2000+1, k = rand()%n+1;
 5     printf("%d %d\n", n, k);
 6     std::vector<int> v;
 7     for(int i = 1; i <= n; i++) {
 8         v.push_back( rand()%100001 );
 9     }
10     for(int x: v) printf("%d\n", x);
11     return 0;
12 }
View Code

g++ std.cpp -std=c++11 -o std.out

g++ A.cpp -std=c++11 -o a.out

duipai.py(python3)

 1 from os import system
 2 for i in range(10000):
 3     system("./makedata.out > in")
 4     system("./a.out < in > out1")
 5     system("./std.out < in > out2")
 6     if(system("diff -bB out1 out2")):
 7         print("GG")
 8         exit(0)
 9     print("Passed %d..."%i)
10     system("sleep 1")
View Code

 

posted @ 2017-11-20 19:38  我在地狱  阅读(164)  评论(0编辑  收藏  举报