Submission #1003769

#TimeUsernameProblemLanguageResultExecution timeMemory
1003769vjudge1Zagrade (COI20_zagrade)C++17
100 / 100
632 ms2224 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>pos; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n,q,i=1,sz; string ans=" "; bool ret; cin >> n >> q; for(i=1;i<=n;i++) { ans+="("; } i=1; while(i<=n) { if(pos.empty()) { pos.pb(i); i++; continue; } cout << "? " << pos.back() << " " << i << endl; fflush(stdout); cin >> ret; if(ret) { ans[i]=')'; pos.pop_back(); }else { pos.pb(i); } i++; } sz=(ll)(pos.size()); for(i=0;i<sz/2;i++) ans[pos[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...