/ SeriousOJ /

Record Detail

Compile Error

foo.cc: In function 'void solve()':
foo.cc:3:11: error: 'cin' was not declared in this scope
    3 |     int n;cin>>n;
      |           ^~~
foo.cc:13:9: error: 'cout' was not declared in this scope
   13 |         cout<<"Hridoy"<<endl;
      |         ^~~~
foo.cc:13:25: error: 'endl' was not declared in this scope
   13 |         cout<<"Hridoy"<<endl;
      |                         ^~~~
foo.cc:16:15: error: 'max' was not declared in this scope
   16 |     int dif = max(od,ev) - min(od,ev);
      |               ^~~
foo.cc:16:28: error: 'min' was not declared in this scope
   16 |     int dif = max(od,ev) - min(od,ev);
      |                            ^~~
foo.cc:19:9: error: 'cout' was not declared in this scope
   19 |         cout<<"Roy"<<endl;
      |         ^~~~
foo.cc:19:22: error: 'endl' was not declared in this scope
   19 |         cout<<"Roy"<<endl;
      |                      ^~~~
foo.cc:26:13: error: 'cout' was not declared in this scope
   26 |             cout<<"Hridoy"<<endl;
      |             ^~~~
foo.cc:26:29: error: 'endl' was not declared in this scope
   26 |             cout<<"Hridoy"<<endl;
      |                             ^~~~
foo.cc:30:13: error: 'cout' was not declared in this scope
   30 |             cout<<"Roy"<<endl;
      |             ^~~~
foo.cc:30:26: error: 'endl' was not declared in this scope
   30 |             cout<<"Roy"<<endl;
      |                          ^~~~

Code

void solve()
{
    int n;cin>>n;
    int od=0,ev=0;
    for(int i=0;i<n;i++)
    {
        int x;cin>>x;
        if(x%2)ev++;
        else od++;
    }
    if(ev==od)
    {
        cout<<"Hridoy"<<endl;
        return;
    }
    int dif = max(od,ev) - min(od,ev);
    if(min(od,ev)%2==1)
    {
        cout<<"Roy"<<endl;
        return;
    }
    else
    {
        if(dif>1)
        {
            cout<<"Hridoy"<<endl;
        }
        else
        {
            cout<<"Roy"<<endl;
        }
    }
}

Information

Submit By
Type
Submission
Problem
P1102 Odd-Even Game
Language
C++17 (G++ 13.2.0)
Submit At
2024-10-04 18:53:13
Judged At
2024-10-04 18:53:13
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes