Submission #706247

#TimeUsernameProblemLanguageResultExecution timeMemory
706247vjudge1Zagrade (COI20_zagrade)C++17
0 / 100
637 ms736 KiB
#include <bits/stdc++.h> // #define endl '\n' #define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define int ll typedef long long ll; using namespace std; const int N = 200000 + 10; bool vis[N]; signed main() { FAST; int n, q; cin >> n >> q; stack<int> st; st.push(0); vis[0] = 1; for(int i = 1; i < n - 1; i++) { if(!st.size()) st.push(1); else { cout << "? " << st.top() + 1 << ' ' << i + 1 << endl; int x; cin >> x; if(x == 1) st.pop(); else { st.push(i); vis[i] = 1; } } } string s = ""; for(int i = 0; i < n; i++) { if(vis[i]) s += "("; else s += ")"; } cout << "! " << s << 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...