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

## 这个不能过？莫非要高精度

Posted by wwwwwwking at 2009-07-02 16:43:48 on Problem 1952
```#include <iostream>
using namespace std;
const int size = 5005;

struct node{
int value;
int layer;
__int64 num;
};
node a[size];
int tmpla[size]={2000000000};

int main ()
{
int input, big;
cin >> input;
big = 0;
for (int i = 1; i <= input; ++i)
{
cin >> a[i].value;
int j;
for (j = i-1; j >= 0; --j)
{
if (tmpla[j] > a[i].value )
break;
}
tmpla[j+1] = a[i].value;
a[i].layer = j+1;
if (a[i].layer>big) big = a[i].layer;
a[i].num = 0;
if (a[i].layer == 1) a[i].num = 1;
}
__int64 sum = 0;  int last = 0;  int lastmax = -1;
for (int i = 1; i <= input; ++i)
{
last = -1;
for (int j = i-1; j > 0; --j)
{
if (a[i].layer-1 == a[j].layer && a[i].value < a[j].value && a[j].value != last)
{	a[i].num += a[j].num;	last = a[j].value;	}
}
if (a[i].layer == big && a[i].value != lastmax )
{
lastmax = a[i].value;
sum += a[i].num;
}
}
cout << big <<" ";
printf ("%I64d\n", sum);
return 0;
}```

Followed by: