标签:represent eof str ast number not src his lines
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 44071 | Accepted: 19125 |
Description
Input
Output
Sample Input
5 1 1 5 1 7 1 3 3 5 5
Sample Output
1 2 1 1 0
Hint
Source
1 #include "bits/stdc++.h" 2 #define mem(a,b) memset(a,b,sizeof(a)) 3 using namespace std; 4 typedef long long LL; 5 const int MAX=32005; 6 int n; 7 int c[MAX],ans[MAX]; 8 void update(int x,int y){for (;x<MAX;c[x]+=y,x+=(x&-x));} 9 int search(int x){ 10 int an(0); 11 for (;x>0;an+=c[x],x-=(x&-x)); 12 return an; 13 } 14 int main(){ 15 freopen ("stars.in","r",stdin); 16 freopen ("stars.out","w",stdout); 17 int i,j; 18 int x,y; 19 scanf("%d",&n); 20 mem(c,0),mem(ans,0); 21 for (i=1;i<=n;i++){ 22 scanf("%d%d",&x,&y); 23 x++; 24 ans[search(x)]++; 25 update(x,1); 26 } 27 for (i=0;i<n;i++) 28 printf("%d\n",ans[i]); 29 return 0; 30 }
标签:represent eof str ast number not src his lines
原文地址:http://www.cnblogs.com/keximeiruguo/p/6021391.html