title : 对拍
tags : ACM,杂项
date : 2022-2-7
author : Linno
对拍
如果你手上有一个数据生成器以及一个答案正确的程序(暴力或者标程),然后需要验证自己的做法是否正确,那么可以写一个对拍去不断比较两个程序的答案。
步骤
以Codeforces 770B为例
①准备一个数据生成器data.exe
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
#define int long long
using namespace std;
signed main(){
srand(time(0));
cout<<"1\n";
int n=rand()%20,x=rand()%10,y=rand()%10;
cout<<n<<" "<<x<<" "<<y<<" \n";
for(int i=1;i<=n;i++) cout<<rand()%10<<" ";
return 0;