
Segment tree
X-Wyatt
For free 邮箱whitezhangv5@gmail.com
展开
-
Codeforces134Div.2-C
用并查集,没有用搜索的方式。中途犯了一点小错误 #include #include #include using namespace std; #define LEN 1010 int p[LEN], x[LEN], y[LEN]; void init() { int i; for(i = 0; i < LEN; i++) { p[i] = i; } } int f原创 2012-10-05 17:30:28 · 659 阅读 · 0 评论 -
HDU 1754
线段树的模板题。 buildTree, insert, update, query 四个函数写的时候注意叶子节点,左右孩子就行了 #include #include #define LEN 400400 #define NMAX -999999 typedef struct Node { int l, r; struct Node* lChild; st原创 2012-09-13 15:03:41 · 390 阅读 · 0 评论 -
HDU 4006
先上一个AC代码,用的是优先队列 #include #include #include #include #include using namespace std; int main(){ int n,k,i,num,j; char str[1000]; while(cin>>n>>k){ priority_queue,greater >q; getchar()原创 2013-01-25 18:31:46 · 850 阅读 · 0 评论