Submission #1004074

#TimeUsernameProblemLanguageResultExecution timeMemory
1004074vjudge1Zagrade (COI20_zagrade)C++17
14 / 100
583 ms5232 KiB
#include <bits/stdc++.h> using namespace std; const int M = 1e5 + 1; char ans[M]; void solve(int a,int b) { if (a+1==b) { ans[a]='('; ans[b]=')'; return; } cout<<"? "<<a+1<<' '<<b-1<<endl; bool v; cin>>v; if (v) { ans[a]='('; ans[b]=')'; solve(a+1,b-1); return; } for (int i=a+1;i<b;i++) { cout<<"? "<<a<<' '<<i<<endl; cin>>v; if (v) { solve(a,i); solve(i+1,b); return; } } } int main() { int n,q; cin>>n>>q; solve(1,n); cout<<"! "; for (int i=1;i<=n;i++) cout<<ans[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...