hihoCoder Challenge 9 register

Ended

Participants:154

Verdict:Accepted
Submitted:2015-03-01 19:36:09

Lang:GCC

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 <stdio.h>
#include <string.h>
#include <stdlib.h>
#define N 100005
struct node{
    int x,num;
}s[N],t[N];
long long  tree[N];
int n,m,T;
int cmp(const void* a,const void* b){
    return (*(struct node*)a).x - (*(struct node*)b).x;
}
int lowbit(int x){
    return x&(-x);
}
void add(int x,int i){
    for(;i<=m;i+=lowbit(i))
        tree[i]+=x;
}
long long sum(int i){
    long long res=0;
    for(;i>=1;i-=lowbit(i))
        res+=tree[i];
    return res;
}
int main(){
    scanf("%d",&T);
    while(T--){
        int i,j;
        long long res=0;
        memset(tree,0,sizeof(tree));
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX