版本比较
题解:P16280 「MierOI R1」Eternal
正文
增加 5 行删除 5 行
6 行未改动7891011111213141514 行未改动3031323334343536373814 行未改动535455565757585959606162632 行未改动6667686970707172737417 行未改动6 行未改动做完了,注意判一下边界。时间复杂度 $O(n^2)$。
```cpp#include <iostream>#include <cstring> #include <cstring>#include <algorithm>#include <queue>#define int long longusing namespace std;14 行未改动signed main(){ int T; cin >> T;
while (T--) { memset(dp, -0x3f, sizeof(dp)); dp[0] = 0;14 行未改动 sa[a[j].r]++; } if (a[i].l < a[j].l && a[i].r == a[j].r) { sb[a[j].l]++; sb[a[j].l]++; } if (a[i].l == a[j].l && a[i].r == a[j].r) if (a[i].l == a[j].l && a[i].r == a[j].r) { t++; } if (a[j].l == a[j].r && a[j].l == a[i].l)2 行未改动 } } for (int j = 1; j <= 2*n; j++) sa[j] += sa[j-1]; for (int j = 2*n; j >= 1; j--) sb[j] += sb[j+1];
for (int j = 1; j <= 2*n; j++) // 枚举一下分割点 { cnt = max(cnt, sa[j] + sb[j]); }17 行未改动