主席树 其实暴力二维树状还更快 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 2005; int N,M,K,Q; struct Node{ int x,y,w; Node(int a=0, int b=0, int c=0):x(a),y(b),w(c){} bool operator < (Node T) { if(x != T.x) return x <…
Garlands 我怎么感觉好水啊. 因为询问只有2000组, 离线询问, 枚举联通块再枚举询问, 二维树状数组更新答案. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PLL pair<LL, LL> #define PLI pair<LL, int> #define PII pair<int…
E. Garlands 题目连接: http://www.codeforces.com/contest/707/problem/E Description Like all children, Alesha loves New Year celebration. During the celebration he and his whole family dress up the fir-tree. Like all children, Alesha likes to play with gar…
C. Three Garlands time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mi…
re了20多发 还是我在测试数据上操作最后了10多发才发现的 其实只需要多加一句就好了 真的愚蠢啊,要不都能进前100了 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 100005; const int INF = 0x3f3f3f3f; int sh[1005][1005]; int flag[1005]; int sum[1005]; int all; int vis[…