| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1154232 | huoi | Zagrade (COI20_zagrade) | C++17 | 229 ms | 652 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF 1e18
void solve() {
int n, q;
cin >> n >> q;
string ans = "(";
stack<char> st;
st.push('(');
for (int i = 1; i < n; i++) {
cout << "? " << i << " " << i + 1 << endl;
bool valid; cin >> valid;
if (valid) {
ans += ")";
st.pop();
} else {
if (ans[i - 1] == '(' || st.empty()) {
ans += "(";
st.push('(');
} else {
ans += ")";
st.pop();
}
}
}
cout << "! " << ans << endl;
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
solve();
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
