这个题目我生成了一个菊花图然后再加了很多边,然后把一半的题解都干废了,有的 RE 有的 TLE 惨不忍睹。
注意:请在 Ubuntu 底下运行,因为 Ubuntu 的 rand 范围可以到 int(?)
#include <bits/stdc++.h>
using namespace std;
int main() {
cout << 100000 << ' ' << 500000 << '\n';
int idx = 0;
for (int i = 2; i <= 100000; i++) cout << 1 << ' ' << i << '\n', idx++;
for (int i = idx + 1; i <= 500000; i++) {
int u = rand() % 100000, v = rand() % 100000;
cout << u << ' ' << v << '\n';
}
return 0;
}