| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:use 64bit integer.In Reply To:why WA? thx Posted by:basic at 2007-07-10 15:04:39 > #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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator