Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

哦~~,代码来一个

Posted by hzoi_hexing at 2014-01-14 17:58:21 on Problem 2352
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator