hiho week 246 register

Ended

Participants:141

Verdict:Accepted
Score:100 / 100
Submitted:2019-03-20 17:36:19

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstring>
using namespace std;
#define maxn 20100
long 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;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX