제출 #986449

#제출 시각아이디문제언어결과실행 시간메모리
986449alexddZagrade (COI20_zagrade)C++17
71 / 100
494 ms1384 KiB
#include<bits/stdc++.h> using namespace std; int n,q; int query(int le, int ri) { if((ri-le+1)%2==1) return 0; cout<<"? "<<le<<" "<<ri<<endl; int aux; cin>>aux; return aux; } char rez[100005]; signed main() { cin>>n>>q; deque<int> dq; for(int i=1;i<=n;i++) { dq.push_back(i); if((int)dq.size()>=2 && query(dq[(int)dq.size()-2],dq.back())) { rez[dq[(int)dq.size()-2]] = '('; rez[dq[(int)dq.size()-1]] = ')'; dq.pop_back(); dq.pop_back(); } } cout<<"! "; for(int i=1;i<=n;i++) cout<<rez[i]; cout<<endl; 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...