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

给大家演示演示stl的imba

Posted by lgeecn at 2011-10-03 23:19:44 on Problem 3671
#include<cstdio>
#include<stdint.h>
#include<vector>
#include<algorithm>
#include<functional>

int main()
{
//	freopen("03671.in","r",stdin);
//	freopen("03671.out","w",stdout);
	uint32_t n;
	fscanf(stdin,"%u",&n);
	std::vector<uint32_t> va;
	for(uint32_t a,i(0);i!=n;++i)
	{
		fscanf(stdin,"%u",&a);
		std::vector<uint32_t>::iterator iter(std::lower_bound(va.begin(),va.end(),a,std::less_equal<uint32_t>()));
		if(iter==va.end())
			va.push_back(a);
		else
			*iter=a;
	}
	fprintf(stdout,"%u\n",n-va.size());
	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