#include <bits/stdc++.h>
using namespace std;
string ans = "";
int query(int a, int b){
cout << "? " << a+1 << " " << b+1 << endl;
int x; cin >> x;
return x;
}
int main(){
cin.tie(0)->sync_with_stdio(false);
int n, q; cin >> n >> q;
vector<int> pos; pos.push_back(0);
for(int i = 1; i<n; i++)
if(pos.empty() || !query(pos.front(), i))
pos.push_back(i), ans += '(';
else ans += ')';
for(int i = 0; i<(int)pos.size()/2; i++)
ans[pos[i]] = ')';
cout << "! " << ans << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Answer length should be 2, but it is 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Answer length should be 2, but it is 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Answer length should be 4, but it is 3 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Answer length should be 4, but it is 3 |
2 |
Halted |
0 ms |
0 KB |
- |