第四篇题解,也就是 @graphcity 的题解是有问题的,在最坏情况下像他这样分解矩形矩形个数会达到 O(n2)。
可以被如下数据卡掉:
#include<bits/stdc++.h>
using namespace std;
int n = 10000;
int q = 5000;
int main() {
freopen("test.in", "w", stdout);
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cout << n << '\n' << q << '\n';
int t = 1;
for(int i = 1; i <= q; ++i, t += 2) {
cout << t << ' ' << t << ' ' << n << ' ' << t << '\n';
}
return 0;
}
由于 CF 上这组 hack 只卡掉了从左往右扫的,并没有卡掉从上往下扫的,所以他过了。