# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
583774 | 2022-06-26T07:51:27 Z | eecs | Zagrade (COI20_zagrade) | C++17 | 0 ms | 208 KB |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0), cin.tie(0); int n; cin >> n >> *new int; auto ask = [&](int a, int b) { cout << "? " << a << " " << b << endl; return cin >> a, a; }; vector<int> st; vector<char> res(n + 1); for (int i = 1; i <= n; i++) { if (st.empty() || !ask(st.back(), i)) st.push_back(i); else res[st.back()] = '(', res[i] = ')', st.pop_back(); } for (int i = 0; i < st.size() / 2; i++) { res[st[i]] = ')'; } for (int i = st.size() / 2; i < st.size(); i++) { res[st[i]] = '('; } cout << "!"; for (int i = 1; i <= n; i++) { cout << " " << res[i]; } cout << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Answer length should be 2, but it is 1 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Answer length should be 2, but it is 1 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Answer length should be 4, but it is 1 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Answer length should be 4, but it is 1 |
2 | Halted | 0 ms | 0 KB | - |