# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
373618 | 2021-03-05T09:36:28 Z | wind_reaper | Zagrade (COI20_zagrade) | C++17 | 901 ms | 1424 KB |
#include <bits/stdc++.h> using namespace std; int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n, q; cin >> n >> q; vector<char> ans(n, '.'); vector<int> st; for(int i = 0; i < n; i++){ if(st.empty()){ st.push_back(i); continue; } cout << "? " << st.back() + 1 << ' ' << i + 1 << endl; bool v; cin >> v; if(v){ ans[st.back()] = '(', ans[i] = ')'; st.pop_back(); } else st.push_back(i); } for(int i = 0; i < st.size() / 2; i++) ans[st[i]] = ')'; for(int i = st.size()/2; i < st.size(); i++) ans[st[i]] = '('; cout << "! "; for(int i = 0; i < n; i++) cout << ans[i]; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 6 ms | 364 KB | Output is correct |
3 | Correct | 8 ms | 364 KB | Output is correct |
4 | Correct | 10 ms | 364 KB | Output is correct |
5 | Correct | 9 ms | 364 KB | Output is correct |
6 | Correct | 10 ms | 364 KB | Output is correct |
7 | Correct | 9 ms | 364 KB | Output is correct |
8 | Correct | 9 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 10 ms | 364 KB | Output is correct |
3 | Correct | 9 ms | 364 KB | Output is correct |
4 | Correct | 12 ms | 384 KB | Output is correct |
5 | Correct | 9 ms | 364 KB | Output is correct |
6 | Correct | 7 ms | 364 KB | Output is correct |
7 | Correct | 10 ms | 364 KB | Output is correct |
8 | Correct | 6 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 413 ms | 492 KB | Output is correct |
3 | Correct | 674 ms | 492 KB | Output is correct |
4 | Correct | 811 ms | 620 KB | Output is correct |
5 | Correct | 726 ms | 620 KB | Output is correct |
6 | Correct | 741 ms | 492 KB | Output is correct |
7 | Correct | 750 ms | 944 KB | Output is correct |
8 | Correct | 733 ms | 620 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 766 ms | 1424 KB | Output is correct |
3 | Correct | 723 ms | 820 KB | Output is correct |
4 | Correct | 738 ms | 1180 KB | Output is correct |
5 | Correct | 832 ms | 940 KB | Output is correct |
6 | Correct | 835 ms | 1132 KB | Output is correct |
7 | Correct | 901 ms | 876 KB | Output is correct |
8 | Correct | 861 ms | 496 KB | Output is correct |