#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Runtime error |
1 ms |
200 KB |
Execution killed with signal 13 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
200 KB |
Mismatch at position 1. Expected ), found ( |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Runtime error |
1 ms |
200 KB |
Execution killed with signal 13 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
200 KB |
Mismatch at position 1. Expected ), found ( |
2 |
Halted |
0 ms |
0 KB |
- |