你这怎么保证没有重边自环(?
by cn_ryh @ 2023-09-21 10:25:51
@[cn_ryh](/user/458193) 那我试试。
by SunnyYuan @ 2023-09-21 10:29:47
多连几朵菊花(雾)
by _Regenbogen_ @ 2023-09-21 10:31:20
@[cn_ryh](/user/458193)
最新的,保证满足题目要求,没有的话我把电脑吃了。
```cpp
#include <bits/stdc++.h>
using namespace std;
unordered_map<int, unordered_map<int, bool> > um;
int main() {
freopen(".in", "w", stdout);
cout << 100000 << ' ' << 500000 << '\n';
int idx = 0;
for (int i = 2; i <= 100000; i++) cout << 1 << ' ' << i << '\n', um[1][i] = um[i][1] = true, idx++;
for (int i = idx + 1; i <= 500000; i++) {
int u = rand() % 100000 + 1, v = rand() % 100000 + 1;
while (u == v || um[u][v]) u = rand() % 100000 + 1, v = rand() % 100000 + 1;
um[u][v] = um[v][u] = true;
cout << u << ' ' << v << '\n';
}
return 0;
}
```
by SunnyYuan @ 2023-09-21 10:37:16
我咋感觉是你没开栈。
by cnyzz @ 2023-09-21 10:54:09
这不就是随机图吗,甚至比随机图还弱,这咋叉的。
by cnyzz @ 2023-09-21 10:55:59
@[cnyzz](/user/175829) 不管了,反正不少题解就是 RE 或者 TLE 了。
by SunnyYuan @ 2023-09-21 10:58:14
我本机跑的飞快,难绷。
我怀疑你电脑要么没开栈,要么你现在还在拿带重边的数据测。
by cnyzz @ 2023-09-21 10:59:58
@[cnyzz](/user/175829) 确实有 killed 的
by cn_ryh @ 2023-09-21 11:05:07
只有 https://www.luogu.com.cn/blog/_post/15938 寄了吧。
by cnyzz @ 2023-09-21 11:15:03