#include<bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);
//#define endl "\n"
#define ll long long
#define N 200005
#define pb push_back
int main(){
lalala;
int n,q;cin>>n>>q;
stack<int> s;
char str[n+1];
s.push(1);
str[1]='(';
for(int i=2;i<=n;i++){
if(s.size()){
int a=s.top();
cout<<"? "<<a<<" "<<i<<endl;
int x;cin>>x;
if(x==1){
str[i]=')';
s.pop();
}
else{
str[i]='(';
s.push(i);
}
}
else{
s.push(i);
str[i]='(';
continue;
}
}
for(int i=1;i<=n;i++)cout<<str[i];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Incorrect query () |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Incorrect query (( |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Incorrect query (()) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Incorrect query (((( |
2 |
Halted |
0 ms |
0 KB |
- |