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

现排序,然后从n*m往下找,直到所有的数都被找过

Posted by kric at 2007-04-13 21:20:21 on Problem 1323
		for(i=n*m,j=0,t=0;j<n;i--)//p[j]降序排列,t记录比当前p[j]大的数的个数,cnt是结果
		{
          if(i==p[j])
		  {
			  if(t)
			  {
				  t--;
				  j++;
			  }
			  else
			  {
			       cnt++;
				   j++;
			  }
		  }
		  else
			  t++;
		}

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