2012年9月29日

spoj 2713 Can you answer these queries IV

摘要: http://www.spoj.pl/problems/GSS4/题意:给一个数列,有两个操作:0 L,R,把区间[L,R]内的数开平方。1 L,R,求区间[L,R]的和。思路:因为一个1e18的数开方8次后必为1,所以时间复杂度为O(8*n+n*log(n))。View Code #include<stdio.h>#include<string.h>#include<iostream>#include<math.h>#define LL long long#define lson rt<<1#define rson rt<&l 阅读全文

posted @ 2012-09-29 21:09 aigoruan 阅读(280) 评论(0) 推荐(0)

Can you answer these queries III

摘要: http://www.spoj.pl/problems/GSS3/题意:求区间的最大连续序列和,带修改。思路:和GSS1差不多,多一个更新而已。View Code #include<stdio.h>#include<string.h>#include<iostream>#define lson rt<<1#define rson rt<<1|1#define LL long longusing namespace std;const LL maxn = 50005;LL bs[maxn],n,m;struct nd{ LL lx,rx 阅读全文

posted @ 2012-09-29 18:14 aigoruan 阅读(183) 评论(0) 推荐(0)

导航