Submission #641568

#TimeUsernameProblemLanguageResultExecution timeMemory
641568devariaotaZagrade (COI20_zagrade)C++17
0 / 100
670 ms700 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++; } j += 2; 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...