#include <bits/stdc++.h>
using namespace std;
int main (){
ios::sync_with_stdio(0);
cin.tie(0);
int n,q;
cin>>n;
cin>>q;
string s="";
s=s+'(';
int p=1;
vector <int> v;
v.push_back(1);
for (int i=1;i<n;i++){
p=v[v.size()-1];
cout<<"? "<<p<<" "<<i+1<<endl;
bool ans;
cin>>ans;
if (ans==0){
s=s+'(';
v.push_back(i+1);
}
if (ans==1){
s=s+')';
v.pop_back();
}
}
cout<<s;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
200 KB |
Incorrect query () |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Incorrect query (( |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
200 KB |
Incorrect query (()) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
200 KB |
Incorrect query (((( |
2 |
Halted |
0 ms |
0 KB |
- |