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 306469974 at 2009-12-03 10:52:30 on Problem 1952
```#include<stdio.h>
#include<stdlib.h>
long int a[5000],b[5000];
__int64 c[5000];
int main()
{
long int n,i,j,t,now;
__int64 count=0;
while(scanf("%ld",&n)!=EOF)
{
for(i=0;i<n;i++)
{
scanf("%ld",&a[i]);
b[i]=1;
c[i]=1;
}
for(i=n-2;i>=0;i--)
{
for(j=i+1;j<n;j++)
if(a[i]>a[j]&&b[i]<b[j]+1)
b[i]=b[j]+1;
if(b[i]==1)	continue;
now=-1;
for(j=n-1;j>i;j--)
{

if(a[i]>a[j]&&b[i]==b[j]+1&&now!=a[j])
{
c[i]+=c[j];
now=a[j];
}
}
c[i]--;
}
t=0;
for(i=1;i<n;i++)
{
/*	printf("%d ",b[i]);*/
if(b[i]>b[t])	t=i;
}
/*	printf("\n");*/
now=-1;
for(i=0;i<n;i++)
{
/*	printf("%d ",c[i]);*/
if(b[i]==b[t]&&now!=a[i])
{
count+=c[i];
now=a[i];
}
}
printf("%ld %I64d\n",b[t],count);
count=0;
}
return 0;
}```

Followed by: