Submission #1114411

# Submission time Handle Problem Language Result Execution time Memory
1114411 2024-11-18T20:12:52 Z MrAndria Zagrade (COI20_zagrade) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
//#define int long long
bool query(int l,int r){
    cout<<"? "<<l<<" "<<r<<endl;
    bool b2;
    cin>>b2;
    return b2;
}
int main(){
    cin>>n>>q;
    v.pb(i);

    for(int i=1;i<=n;i++){
        v.pb(i);   
        if(v.size()<2){
            continue;
        }
        b1=query(v[v.size()-2],v[v.size()-1]);
        if(b1){
            c[v[v.size()-2]]='(';
            c[v[v.size()-1]]=')';
            v.pop_back();
            v.pop_back();
        }


        
    }
    if(v.size()){

        cout<<"! ";
        cout<<-1<<endl;

    }else{
        for(int i=1;i<=n;i++){
            cout<<c[i];
        }
        cout<<endl;
    }
}

Compilation message

zagrade.cpp: In function 'int main()':
zagrade.cpp:14:10: error: 'n' was not declared in this scope; did you mean 'yn'?
   14 |     cin>>n>>q;
      |          ^
      |          yn
zagrade.cpp:14:13: error: 'q' was not declared in this scope
   14 |     cin>>n>>q;
      |             ^
zagrade.cpp:15:5: error: 'v' was not declared in this scope
   15 |     v.pb(i);
      |     ^
zagrade.cpp:15:10: error: 'i' was not declared in this scope
   15 |     v.pb(i);
      |          ^
zagrade.cpp:22:9: error: 'b1' was not declared in this scope; did you mean 'y1'?
   22 |         b1=query(v[v.size()-2],v[v.size()-1]);
      |         ^~
      |         y1
zagrade.cpp:24:13: error: 'c' was not declared in this scope
   24 |             c[v[v.size()-2]]='(';
      |             ^
zagrade.cpp:40:19: error: 'c' was not declared in this scope
   40 |             cout<<c[i];
      |                   ^