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 1494. Monobilliards

Nebojsa Wa #7 [2] // Problem 1494. Monobilliards 2 May 2008 03:00
Can somebody gives me some tests
Nebojsa Re: Wa #7 [1] // Problem 1494. Monobilliards 5 May 2008 02:56
Help please!
 Here is my code
#include <iostream>
using namespace std;

long a[100000];
long b[100000];
long c[100000];

int main()
{
    long n,k=1,s,s1,l;

    cin>>n;
    if(n==2)
    {
    cout<<"Not a proof";
    goto tu;
}
for(int i=n;i>0;i--)
{
        cin>>a[i];
        }

        while(a[k]<a[k+1])
        {
                          b[k]=a[k];
                          l=k;
                          k++;
                          }
                    if(n-k==0)
                    {
    cout<<"Not a proof";
    goto tu;
}

                    for(int i=k;i<=n;i++)
                    {
                            c[i]=a[i];
                            }
      n-=k;
   for(int i=k;i<=n;i++)
   {
           if(c[i]>=c[i+1])
           {
    cout<<"Cheater";
    goto tu;
}}
     cout<<"Not a proof";
     tu: ;
     system("pause");
     return 0;
     }

Edited by author 05.05.2008 02:57
Nebojsa Re: Wa #7 // Problem 1494. Monobilliards 5 May 2008 03:00
And this my other solution
#include <iostream>
using namespace std;
long a[1000000];
long u[1000000];
int main()
{
    long n,b=0;
    cin>>n;
    int s=0,br=0,s1=0,x=1;



    for(int i=1;i<=n;i++)
    {
            cin>>a[i];
            }
             for(int i=n;i>0;i--)
            {  b=a[i];
                u[x]=b;
                x++;
                    }
            for(int i=1;i<=n;i++)
            {
                  s1=u[i+1]-u[i];
                    if((u[i]<u[i+1]) && (s1>1))br++;
                    }
                    for(int i=1;i<=n;i++)
                    {s=u[i+1]-u[i];
                    if(s>1)
                    {
                    if(s==a[br]) br--;
                    else
                    {cout<<"Cheater";
                    goto tu;
                    }
                    if(s<0 && br==0)
                    {cout<<"Cheater";
                    goto tu;
                    }
                    }
                    }
                    cout<<"Not a proof";

                    tu :;
                    system("pause");
                    return 0;
                    }

Edited by author 05.05.2008 03:00