Submission #706281

#TimeUsernameProblemLanguageResultExecution timeMemory
706281vjudge1Zagrade (COI20_zagrade)C++17
71 / 100
856 ms780 KiB
#include <bits/stdc++.h> #include <fstream> //#define endl '\n' #define mod 998244353 #define INF 100000000000 #define ll long long ///#define cin fin ///#define cout fout #define fi first #define se second using namespace std; ///ofstream fout("herding.out"); ///ifstream fin("herding.in"); int main() { ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0); int n, q; cin >> n >> q; stack<int> st; st.push(1); string s; s.push_back('('); for(int i = 2; i <= n; i++) { if(st.empty()) { st.push(i); s.push_back('('); continue; } cout << '?' << ' ' << st.top() << ' ' << i << endl; int ans; cin >> ans; if(ans == 1) { st.pop(); s.push_back(')'); } else { st.push(i); s.push_back('('); } } 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...