跳到正文

个人记录

对拍

_ideal_freedom_pop_约 2 分钟
原文
文章信息与版本

文章信息

发布
2026年12月1日
收录
2026年12月2日
更新
2026年12月2日
篇幅
约 2 分钟

版本

  1. v1当前
C++
#include<bits/stdc++.h>
#define int long long
using namespace std;

// -std=c++14 -O2
mt19937_64 rng(time(0) ^ _getpid());

int rnd(int l, int r) {
	// 生成[l, r]范围内随机的一个数字 
	return l + rng() % (r-l+1);
}

signed main() {
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	freopen("duipai.txt", "w", stdout);  // 注意是写数据到文件当中 
	int n = rnd(1, 1000);
	int m = rnd(1, 100);
	cout << n << " " << m << '\n';
	for (int i=1; i<=n; i++) {
		cout << rnd(1, 1e2) << " ";
	}
	cout << '\n';
	for (int i=1; i<=m; i++) {
		cout << rnd(1, 150) << '\n';
	}
	return 0;
}



C++
#include<bits/stdc++.h>
using namespace std;
void run(int idx) {
	// system("命令"); 相当于在cmd下执行这个命令
	system("gen");  // 运行生成数据的脚本
	system("brute < duipai.txt > brute.out");  // 运行暴力解 
	system("std < duipai.txt > std.out");  // 运行正解 
	if(system("fc /n brute.out std.out")) {
		cout<<"WA!!!\n";
		system("copy duipai.txt wa.txt");  // 保留错误的样例,查错。 
		exit(0);
	}
	cout<<"第"<<idx<<"组数据AC!!!\n";
}

int main() {
//	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int t=1000;
	for(int i=1;i<=t;i++){
		run(i);
	}
	return 0;
}
原文