Submission #473174

# Submission time Handle Problem Language Result Execution time Memory
473174 2021-09-15T09:47:05 Z Ahmed_Solyman Doktor (COCI17_doktor) C++14
Compilation error
0 ms 0 KB
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);      cout.tie(0);
    ll n;cin>>n;
    vector<ll>arr(n);
    for(auto &i:arr)cin>>i;
    int x=1,y=1;
    int mx=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            reverse(arr.begin()+i,arr.begin()+j+1);
            ll cnt=0;
            for(ll k=i;k<=j;k++){
                cnt+=(arr[k]==k+1);
            }
            if(cnt>mx){
                x=arr[i];y=arr[j];
                mx=cnt;
            }
            reverse(arr.begin()+i,arr.begin()+j+1);
        }
    }
    cout<<arr[x]<<" "<<arr[y]<<endl;
}

Compilation message

doktor.cpp: In function 'int main()':
doktor.cpp:2:5: error: 'ios_base' has not been declared
    2 |     ios_base::sync_with_stdio(0);
      |     ^~~~~~~~
doktor.cpp:3:5: error: 'cin' was not declared in this scope
    3 |     cin.tie(0);      cout.tie(0);
      |     ^~~
doktor.cpp:3:22: error: 'cout' was not declared in this scope
    3 |     cin.tie(0);      cout.tie(0);
      |                      ^~~~
doktor.cpp:4:5: error: 'll' was not declared in this scope
    4 |     ll n;cin>>n;
      |     ^~
doktor.cpp:4:15: error: 'n' was not declared in this scope
    4 |     ll n;cin>>n;
      |               ^
doktor.cpp:5:5: error: 'vector' was not declared in this scope
    5 |     vector<ll>arr(n);
      |     ^~~~~~
doktor.cpp:5:15: error: 'arr' was not declared in this scope
    5 |     vector<ll>arr(n);
      |               ^~~
doktor.cpp:11:13: error: 'reverse' was not declared in this scope
   11 |             reverse(arr.begin()+i,arr.begin()+j+1);
      |             ^~~~~~~
doktor.cpp:12:15: error: expected ';' before 'cnt'
   12 |             ll cnt=0;
      |               ^~~~
      |               ;
doktor.cpp:13:19: error: expected ';' before 'k'
   13 |             for(ll k=i;k<=j;k++){
      |                   ^~
      |                   ;
doktor.cpp:13:24: error: 'k' was not declared in this scope
   13 |             for(ll k=i;k<=j;k++){
      |                        ^
doktor.cpp:14:17: error: 'cnt' was not declared in this scope; did you mean 'int'?
   14 |                 cnt+=(arr[k]==k+1);
      |                 ^~~
      |                 int
doktor.cpp:16:16: error: 'cnt' was not declared in this scope; did you mean 'int'?
   16 |             if(cnt>mx){
      |                ^~~
      |                int
doktor.cpp:23:32: error: 'endl' was not declared in this scope
   23 |     cout<<arr[x]<<" "<<arr[y]<<endl;
      |                                ^~~~