hiho week 39 register

Ended

Participants:2159

Verdict:Accepted
Score:100 / 100
Submitted:2015-03-29 14:45:27

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 <cstring>
#include <algorithm>
using namespace std;
const int N = 100010;
struct node{
    int x;
    int id;
    bool operator<(const node& b)const
    {
        return x<b.x;
    }
}e[N];
int n;
int sum[N];
int getid(int x){return x&-x;}
int getsum(int x){
    int ret=0;
    while(x){
        ret+=sum[x];x-=getid(x);
    }
        return ret;
}
void add(int x){
    while(x<=n){
        sum[x]++;
        x+=getid(x);
    }   
}
int  main(){
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX