Submission #1015873

#TimeUsernameProblemLanguageResultExecution timeMemory
101587312345678Zagrade (COI20_zagrade)C++17
14 / 100
712 ms1360 KiB
#include <bits/stdc++.h> using namespace std; const int nx=1e5+5; int n, res[nx], x, q; int query(int l, int r) { cout<<"? "<<l<<' '<<r<<'\n'; fflush(stdout); cin>>x; return x; } void solve(int l, int r) { if (r<l) return; if (r==l+1) return res[l]=1, void(); for (int i=l+1; i<r; i++) if (((i-l+1)%2)==0&&query(l, i)) return solve(l, i), solve(i+1, r), void(); res[l]=1; solve(l+1, r-1); } int main() { cin>>n>>q; solve(1, n); cout<<"! "; for (int i=1; i<=n;i ++) cout<<(res[i]?'(':')'); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...