Submission #1003868

#TimeUsernameProblemLanguageResultExecution timeMemory
1003868vjudge1Zagrade (COI20_zagrade)C++17
14 / 100
751 ms680 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define pii pair<int,int> #define tii tuple<int,int,int,int,int> #define all(x) x.begin(),x.end() #define allr(x) x.rbegin(),x.rend() vector<char> ans; int n; bool ask(int l, int r){ cout << "? " << l << " " << r << endl; int rt; cin >> rt; return rt; } void solve(int l, int r){ if(r<l) return; for(int i=l+1; i<=r; i+=2){ if(ask(l,i)){ ans[l]='('; ans[i]=')'; solve(l+1,i-1); solve(i+1,r); break; } } return; } signed main(){ int q; cin >> n >> q; ans.resize(n+1); solve(1,n); cout << "! "; for(int i=1; i<=n; i++) cout << ans[i]; cout << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...