题意就不说了有几个值得注意的地方,首先,数据范围太大,要离散化有一个问题就是1 5 5离散化后可能是1 3 2本来应该是1 2 3的,就会出错所以排序的时候加个按关键值排序,值相同时按id递增排序View Code #include<cstdio>#include<algorithm>using namespace std;const int mod=1000000007;const int maxn=100000;struct node{ int num; int id;}a[maxn+10];__int64 dp[maxn+10];int num[maxn+10]; Read More
posted @ 2012-01-12 18:08 Because Of You Views(289) Comments(0) Diggs(0) Edit
时间卡的比较紧,险过,成段更新,懒惰标记 发现define max(a,b)比写个函数来的快,不知为何区间记录三个域最大值、最小值、增加的值如果最大值<P,加上2*c如果最小值>=p,加上c;注意每次别忘了把信息pushdown下来就好了最后只需query()一次View Code #include<cstdio>#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1#define max(a,b) (a>b?a:b)#define min(a,b) (a<b?a:b)const int ma Read More
posted @ 2012-01-12 11:26 Because Of You Views(342) Comments(0) Diggs(0) Edit