Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include <cstdio>#include <iostream>#include <algorithm>#include <vector>#include <cmath>#include <cstring>using namespace std;#define maxn 20100long long pnum[maxn],tnum[maxn];long long data[maxn],ans[maxn];long long n,m,s,t,cur;typedef struct BLOCK{long long l,r,bs,id;friend bool operator <(struct BLOCK A, struct BLOCK B){return A.bs==B.bs?A.r<B.r:A.bs<B.bs;}}Block;long long lowbits(long long x){return x&-x;}void update(long long *a,long long p,long long x){for(p;p<=maxn;p+=lowbits(p))a[p]+=x;}long long sum(long long *a,long long p){long long rs = 0;for(p;p>0;p-=lowbits(p))rs+=a[p];return rs;}