###### HDU Stars

It's a simple tree_array problem.

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>

const int M = 32005;
const int N = 15005;

int Bit[M<<1];

void Insert(int x,int value){
for(int i = x ; i<= M ; i += i & (-i)){
Bit[i] += value;
}
}

int Query(int x){
int ret = 0;
if(x <= 0) return ret;
for(int i = x; i ; i -= i & (-i)){
ret += Bit[i];
}
return ret;
}

void Deal_with(){
int n;
int sum[N];
while(~scanf("%d",&n)){
int tempx,tempy;
memset(sum,0,sizeof(sum));
memset(Bit,0,sizeof(Bit));
for(int i=0;i<n;i++){
scanf("%d %d",&tempx,&tempy);
sum[Query(tempx+1)] ++ ;
Insert(tempx+1,1);
}
for(int i=0;i<n;i++){
printf("%d\n",sum[i]);
}
}
}

int main(void){
//freopen("a.in","r",stdin);
Deal_with();
return 0;
}

#### HDU 2677 Dota all stars 深搜

2016-06-20 09:59:00

#### [HDOJ 2677][Vjudge 27932] Dota all stars [模拟]

2014-07-12 09:40:01

#### HDU 100道搜索题 每天几个练练手 mark

2016-11-30 16:13:09

#### 2017 ccpc 湘潭邀请赛 H highway

2017-05-25 17:43:12

#### 杭电搜索100 练手用

2017-03-05 21:48:37

#### 小奇挖矿 Explo

2017-02-10 10:26:12

#### uva11988 broken keyboard （悲剧文本）

2017-01-19 13:27:01

#### HDOJ搜索题(总计100题)

2013-06-07 14:02:28

#### 51nod 1489 蜥蜴和地下室 dfs

2017-08-08 23:25:30

#### dota war3map.j 解读

2015-09-08 12:12:36

HDU Stars