Submission #641569

#TimeUsernameProblemLanguageResultExecution timeMemory
641569makanhuliaZagrade (COI20_zagrade)C++17
0 / 100
686 ms1164 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { cin.tie(0); ios_base::sync_with_stdio(0); int n, q; cin >> n >> q; vector<int> ans(n, -1); for(int i = 0; i < n - 1; i++) { cout << "? " << i + 1 << " " << i + 2 << endl; int x; cin >> x; if(x) { ans[i] = 1; ans[i + 1] = 0; i++; } } cout << "! "; for(int i = 0; i < n; i++) { if(ans[i] == -1) { int cnt = 0; int j = i; for(; ans[j] == -1; j++) { ans[j] = 1; cnt++; } while(ans[j] != -1) j++; for(; cnt > 0; j++, cnt--) { ans[j] = 0; } } 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...