跳到正文

算法·理论

OI赛制中的对拍

Caiwenyu约 1 分钟
原文

这是 2026年3月20日 存档的第 1 版,不是当前版本。查看当前版本

文章信息与版本

文章信息

收录
2026年3月20日
更新
2026年8月2日
篇幅
约 1 分钟

版本

  1. v2当前
  2. v1

数据生成器

C++
#include<bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::system_clock::now().time_since_epoch().count());
uniform_int_distribution<int> dis(1,1000000);
int main()
{
	int n=dis(rnd);
	cout<<n<<"\n";
	for(int i=1;i<=n;i++)
		cout<<dis(rnd)<<" ";
	return 0;
}

对拍器

C++
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int id=0;
	while(1)
	{
		system("data.exe>data.txt");
		system("std.exe<data.txt");
		system("apple.exe<data.txt>test.txt");
		if(!system("fc std.txt test.txt"))
			cout<<++id<<": AC\n";
		else break;
	} 
	return 0;
}