@@ -1852,3 +1852,69 @@ FixNamespaceComments: false
18521852}
18531853```
18541854
1855+ ## 对拍程序
1856+
1857+ [ testlib/testlib.h at master · MikeMirzayanov/testlib] ( https://github.com/MikeMirzayanov/testlib/blob/master/testlib.h )
1858+
1859+ ### duipai.cpp
1860+
1861+ ``` cpp
1862+ #include < cstdio>
1863+ #include < cstdlib>
1864+
1865+ using namespace std ;
1866+
1867+ int main ()
1868+ {
1869+ system ("clang++ ac.cpp -o ac.out -W -Wall -O2 -std=c++20 -stdlib=libc++ -I/root/cpp/lib");
1870+ system("clang++ wa.cpp -o wa.out -W -Wall -O2 -std=c++20 -stdlib=libc++ -I/root/cpp/lib");
1871+ system("clang++ data.cpp -o data.out -W -Wall -O2 -std=c++20 -stdlib=libc++");
1872+ char data_gen_cmd[ 64] ;
1873+ int seed = 0;
1874+ while(1)
1875+ {
1876+ sprintf(data_gen_cmd, "./data.out %d > ./in.txt 897", seed);
1877+ printf("%d...\n", seed++);
1878+ system(data_gen_cmd);
1879+ system("./ac.out < ./in.txt > ./ac.txt");
1880+ system("./wa.out < ./in.txt > ./wa.txt");
1881+ if (system("diff ./ac.txt ./wa.txt"))
1882+ {
1883+ system("cat ./in.txt");
1884+ break;
1885+ }
1886+ }
1887+ return 0;
1888+ }
1889+ ```
1890+
1891+ ### data.cpp
1892+
1893+ ``` cpp
1894+ #include " testlib.h"
1895+ #include < cstdio>
1896+ #include < iostream>
1897+
1898+ using namespace std ;
1899+ using LL = long long ;
1900+
1901+ int main (int argc, char ** argv)
1902+ {
1903+ registerGen(argc, argv, 1);
1904+ FILE * fp = freopen("in.txt", "w", stdout);
1905+ LL n = rnd.next(1ll, (LL)1E15);
1906+ int m = rnd.next(1, (int)2E5);
1907+ cout << n << ' ' << m << '\n';
1908+ while (m--)
1909+ {
1910+ int a = rnd.next(2, 300);
1911+ int b = rnd.next(1, a - 1);
1912+ cout << a << ' ' << b << '\n';
1913+ }
1914+ // println(rnd.next(1, 10)); /* Random number in the range [ 1,10] . * /
1915+ // println(rnd.next("[ a-zA-Z0-9] {1,1000}")); /* Random word of length [ 1,1000] . * /
1916+ fclose(fp);
1917+ return 0;
1918+ }
1919+ ```
1920+
0 commit comments