提供对拍生成器
查看原帖
提供对拍生成器
851600
Lezy233楼主2024/10/8 23:08
#include <bits/stdc++.h>
std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());

const int N = 6;

int main()
{
	int n = N+rng()%N;
	std::cout<<n<<"\n";
	std::vector<std::array<int,2>> son(n+1, {-1, -1});
	for(int i=1, tot=1; i<=n; ++i) {
		for(auto &j:son[i]) {
			j = ++tot;
			if(tot == n) break;
		}
		if(tot == n) break;
	}
	
	for(int i=1; i<=n; ++i) {
		std::shuffle(son[i].begin(), son[i].end(), rng);
		std::cout<<son[i][0]<<" "<<son[i][1]<<"\n";
	}
	return 0;

}
2024/10/8 23:08
加载中...