摘要:
把数值和查询放在一起从小到大排序,纪录每个数值的位置,当遇到数值时就更新到树状数组中,遇到查询就直接查询该区间和。#include #include #include #include using namespace std;const int MAXN = 200100;struct node{ int id; int L, R; int val;} qq[MAXN];int N, Q;int cntQ;int ans[MAXN/2];int C[MAXN];bool cmp( const node& a, const node& b ){ if ( a.val ==... 阅读全文
posted @ 2013-10-11 22:51
冰鸮
阅读(247)
评论(0)
推荐(0)

浙公网安备 33010602011771号