Submission #1003767

#TimeUsernameProblemLanguageResultExecution timeMemory
1003767vjudge1Zagrade (COI20_zagrade)C++17
71 / 100
612 ms1548 KiB
#include<bits/stdc++.h> using namespace std; #define N 200010 #define INFLL 2000000000000000020 #define pb push_back typedef long long ll; typedef pair<ll,ll> pll; vector<ll>abre; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n,q,i=1; string ans=" "; bool ret; cin >> n >> q; for(i=1;i<=n;i++) { ans+="("; } i=1; while(i<=n) { if(abre.empty()) { abre.pb(i); i++; continue; } cout << "? " << abre.back() << " " << i << endl; fflush(stdout); cin >> ret; if(ret) { ans[i]=')'; abre.pop_back(); }else { abre.pb(i); } i++; } cout << "!" << ans << endl; fflush(stdout); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...