Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:哦~~,代码来一个In Reply To:哦~~,代码来一个 Posted by:hzoi_hexing at 2014-01-14 17:58:21 > #include<cstdio> > #include<cstring> > #include<cstdlib> > #include<cmath> > #include<string> > #include<iostream> > #include<algorithm> > using namespace std; > //hzoi_hexing 原创 > #define N 150000 > int x,y; > int c[N]; > int s[N]; > int n; > inline int lowbit(int x){ > return x & (-x); > } > > void insert(int x,int z){ > for (int i = x; i <= 60000; i+=lowbit(i)){ > c[i]+=z; > } > return; > } > int ask(int x){ > int ans = 0; > for (int i = x; i>0; i -= lowbit(i)) ans += c[i]; > return ans; > } > > int main(){ > int x,y; > scanf("%d",&n); > for (int i = 1; i<=n; i++){ > scanf("%d%d",&x,&y); > ++x; > insert(x,1); > s[ask(x)-1]++; > } > for (int i = 0; i <n; i++) > printf("%d\n",s[i]); > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator