stars
来源:互联网 发布:游戏官方网站源码 编辑:程序博客网 时间:2024/05/17 03:18
#include <iostream>
#include <string.h>
#include <stdio.h>
using namespace std;
const int maxn = 32005;
int c[maxn];
int ans[maxn];
int lowbit(int x) {
return x&(-x);
}
void add(int x){
while(x<=maxn){
c[x]+=1; x+=lowbit(x);
}
}
int sum(int x){
int ret=0;
while(x>0){
ret+=c[x]; x-=lowbit(x);
}
return ret;
}
int main(){
int n,x,y,i;
while(scanf("%d",&n)!=EOF){
memset(ans,0,sizeof(ans));
memset(c,0,sizeof(c));
for(i=0;i<n;i++){
scanf("%d %d",&x,&y);
ans[ sum(++x)]++;
add(x);
}
for(i=0;i<n;i++)
printf("%d\n",ans[i]);
}
return 0;
}
0 0
- stars
- Stars
- Stars
- Stars
- Stars
- Stars
- Stars
- Stars
- stars
- Stars
- Stars
- stars
- Stars
- Stars
- Stars
- 7stars
- PKU2352 stars
- hdu1541 Stars
- 计算器(java)
- nformatica学习笔记
- hdu4923 Room and Moor 单调栈
- JAVA容器笔记
- 显示意图激活另外一个activity(检查用户的网络情况2.3.3)
- stars
- linux内核学习(20)设备模型第二层之一
- 打开一个URL并获取http状态码
- OC视频笔记-5
- span与div 行内元素和块元素(标签)
- 关于java中Double类型的运算精度问题
- C++ 工厂模式
- Python::SocketServer
- Linux设备模型分析之device(基于3.10.1内核)