ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1666. Vasya Ferrari

what is test case 6?
Posted by demo 21 Dec 2008 08:45
I got too many wa on it..
Re: what is test case 6?
Posted by demo 21 Dec 2008 09:18
got it
Re: what is test case 6?
Posted by N.M.Hieu ( DHSP ) 23 Dec 2008 13:15
I got WA, too.
Can you tell me this case ?
Re: what is test case 6?
Posted by N.M.Hieu ( DHSP ) 23 Dec 2008 13:51
Got it.
Here is the case that helped me:
9998 -20000 0 0
Result:
(x)(x)(x-2)(x+10000)

Edited by author 23.12.2008 13:51
Re: what is test case 6?
Posted by Grigory 'Stargazer' Javadyan [RAU] 23 Dec 2008 13:52
#include<iostream.h>
int max1(int *x,int *y,int i,int j)
{
    int k,m1=0,r=-1;bool p=true;
    for(k=i+1;k<=j&&p&&r==-1;k++)
        if(x[k]>=x[i])
        {
            m1=y[k];
            r=k;
            p=false;
        }
        if(r!=-1){
        for(k=r;k<=j;k++)
            if(x[k]>=x[i] && y[k]>=m1)
                m1=y[k];

            return m1+1;
        }
        return -1;
}
int main()
{
    int n,a[1005],i,l[1005],max;
    cin>>n;
    for(i=1;i<=n;i++)
        cin>>a[i];
    l[n]=1;
    if(a[n-1]>a[n])
        l[n-1]=1;
    else
        l[n-1]=2;
    for(i=n-2;i>=1;i--)
        l[i]=max1(a,l,i,n);
    max=l[1];
    for(i=2;i<=n;i++)
        if(l[i]>max)
            max=l[i];
        cout<<max;
return 0;
}