#include <bits/stdc++.h>
using namespace std;
const int N = (int) 1e5 + 7;
int n;
int q;
int a[N];
vector<int> stk;
int main() {
cin >> n >> q;
for (int i = 1; i <= n; i++) {
if (stk.empty()) {
stk.push_back(i);
a[i] = +1;
continue;
}
int j = stk.back();
cout << j << " " << i << endl;
int ret;
cin >> ret;
if (ret) {
stk.pop_back();
a[i] = -1;
} else {
stk.push_back(i);
a[i] = +1;
}
}
cout << "! ";
for (int i = 1; i <= n; i++) {
if (a[i] == +1) {
cout << "(";
} else {
cout << ")";
}
}
cout << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 13 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
364 KB |
Execution killed with signal 13 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
364 KB |
Execution killed with signal 13 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
364 KB |
Execution killed with signal 13 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |