题意:n个点.m个操作.两种操作类型.C X Y K 表示区间[x,y]上每一个点值加k.Q X Y 求区间[x,y]的和 分析:线段树区间求和,裸模板 注意:结果会超int,要用long long 表示,假设是在hust上交结果要用%I64d.poj的话则用%lld 代码: #include <iostream> #include <cstdio> #include <cstring> #include <queue> #include <algor…
poj-2104(区间第K大问题) #include <iostream> #include <algorithm> #include <cstdio> #include <cstring> using namespace std; struct T { int ls; int rs; int sum; }; ; T tri[*N]; int a[N],sort_a[N]; int rt[N]; int cnt; int n,m; void update (…
Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones. Your task is counting the segments of different colors you can see at last. InputThe first line of each data set contains exactly o…
Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones. Your task is counting the segments of different colors you can see at last. Input The first line of each data set contains exactly…