Submission #640220

#TimeUsernameProblemLanguageResultExecution timeMemory
640220devariaotaZagrade (COI20_zagrade)C++17
14 / 100
9 ms464 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<ll> vll; const ll mod=1e9+7; const ll maxn=1e3+5; const int INF=1e9+5; #define ok ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define fi first #define se second #define pb push_back #define ub upper_bound #define lb lower_bound #define endl '\n' int n, q, bk, ttp, jwb; stack<int> st; char ans[maxn]; int main() { ok cin >> n >> q; for(int i=1; i<=n; i++) { if(st.empty()) { ans[i]='('; st.push(i); continue; } cout << "? " << st.top() << " " << i << endl; cout.flush(); cin >> jwb; if(jwb==1) { ans[i]=')'; st.pop(); } else { ans[i]='('; st.push(i); } } 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...