社区讨论
提供对拍生成器
P3621[APIO2007] 风铃参与者 2已保存回复 1
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 1 条
- 当前快照
- 1 份
- 快照标识符
- @m20kt8kp
- 此快照首次捕获于
- 2024/10/08 23:08 去年
- 此快照最后确认于
- 2025/11/04 17:36 4 个月前
CPP
#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;
}
回复
共 1 条回复,欢迎继续交流。
正在加载回复...