HDU 1541 Stars 树状数组
来源:互联网 发布:指纹识别算法 源代码 编辑:程序博客网 时间:2024/05/22 08:26
#include<iostream>#include<cstring>#include<cstdio>#include<cmath>#include<algorithm>#include<cstdlib>#include<map>#include<queue>#include <deque>#include <list>#include <ctime>#include <stack>#include <vector>#include<set>#define Maxn 15233#define Maxx 32333#define MODtypedef long long ll;#define FOR(i,j,n) for(int i=j;i<=n;i++)#define DFR(i,j,k) for(int i=j;i>=k;--i)#define lowbit(a) a&-a#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1const int inf = 0x3f3f3f3f;const double pi = acos(-1.0);using namespace std;int cnt[Maxn],c[Maxx];int n,x,y;int sum(int i){ int s=0; while(i>0) { s+=c[i]; i-=lowbit(i); } return s;}int add(int i,int val){ while(i<=Maxx) { c[i]+=val; i+=lowbit(i); }}int main(){ while(~scanf("%d",&n)) { memset(c,0,sizeof(c)); memset(cnt,0,sizeof(cnt)); FOR(i,1,n) { scanf("%d%d",&x,&y); cnt[sum(++x)]++; add(x,1); } for(int i=0;i<n;i++) printf("%d\n",cnt[i]); } return 0;}
0 0
- HDU 1541 Stars【树状数组】
- hdu 1541 Stars (树状数组)
- HDU 1541 Stars (树状数组)
- 【树状数组】hdu 1541 Stars
- hdu-1541 Stars-----> 树状数组
- hdu 1541 树状数组 Stars
- HDU 1541 Stars 树状数组
- hdu 1541 Stars(树状数组)
- hdu 1541 Stars 树状数组
- 【HDU 1541 Stars 树状数组】
- hdu 1541 Stars ( 树状数组 )
- hdu 1541 Stars(树状数组)
- hdu 1541 Stars【树状数组简单应用】
- hdu 1541 Stars (树状数组)
- hdu 1541 stars(树状数组)
- HDU 1541 Stars (树状数组)
- HDU 1541 Stars(树状数组)
- hdu 1541 stars (树状数组)
- 链表的创建(头插,尾插),插入,删除
- 第6章 深入使用Hibernate 6.4 使用HQL查询
- Java中常用缓存Cache机制的实现
- linux文件属性
- flappybird 学习研究
- HDU 1541 Stars 树状数组
- Git --- 简单总结一下git版本控制工具的常见使用方法
- mysql_fetch_lengths()--MySql数据库
- POJ 1741 Tree (树分治之点分治)
- Struts2标签
- 【LeetCode从零单刷】Container With Most Water
- Android JNI使用总结(一)
- POJ - 2018 Best Cow Fences(DP)
- Chapter5-标准I/O库(上)-「APUE读书笔记」