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

why WA? thx

Posted by basic at 2007-07-10 15:04:39 on Problem 3250
#include <cstdio>
#include <algorithm>
#include <functional>
using namespace std;

int n, h, a[80000], res = 0;
int* e = a;

int main() {
	scanf("%d", &n);
	while (n--) {
		scanf("%d", &h);
		e = lower_bound(a, e, h, greater<int>());
		res += e - a;
		*e++ = h;
	}
	printf("%d\n", res);
}

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