hack 第 5 篇题解,能卡成 O(n2)。
#include <bits/stdc++.h>
using namespace std;
int n = 69994, m = 7777, tot;
int get() {
int rt = ++tot;
for (int i = tot + 1; i <= tot + 3; i++) cout << i - 1 << ' ' << i << '\n';
tot += 3;
return rt;
}
int solve() {
int rt = ++tot;
int l = get();
cout << rt << ' ' << l << '\n';
int r = get();
cout << rt << ' ' << r << '\n';
return rt;
}
int main() {
freopen("hack_data.in", "w", stdout);
cout << n << '\n';
tot = 1;
for (int i = 1; i <= m; i++) {
int rt = solve();
cout << 1 << ' ' << rt << '\n';
}
}