BZOJ1227 [SDOI2009]虔诚的墓主人
写完Kdtree感觉整个人都要离散了。 这题比较神,之前连题都没看懂。每个位置的方案数就是上下左右的数量的组合数的乘积。把x离散之后维护区间中左×右的和,上下y相同的扫一遍搞定。(感觉说了像没说) #include <cstdio> #include <cstring> #include <algorithm> using namespace std; struct point { int x, y; }; const int maxn = 100009; const int maxk = 13; inline bool cmpP(int* a, int* b) { return *a < *b; } inline bool cmpy(const point& a, const point& b) { return (a. y < b. y) || (a. y == b. y && a. x < b. x); } point a[maxn]; int n, m, c[maxn][maxk], cx[maxn], tx[maxn], t[maxn], maxx, ans;...