#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define pb push_back
#define mpr make_pair
const ll N=2e6 + 10 , mod=1e9 + 7, inf=1e18;
using namespace std;
ll n,m,k,q,c,x,y;
ll t[N];
vector<bool>vis(false,1000);
int main(){
ios_base::sync_with_stdio (0); cin.tie(0),cout.tie(0);
// freopen("dining.in","r",stdin);
// freopen("dining.out","w",stdout);
ll T=1;
//cin>>T;
while(T--){
cin>>n>>q;
ll l=1,r=2,tot=0;
string ch="(";
priority_queue<ll>pq;
while(ch.size()<n-1){
cout<<"? "<<l<<" "<<r<<endl;
cin>>x;
if(x==1){
ch+=")";
if(!pq.empty()){
l=pq.top();
pq.pop();
}else{
ch+='(';
l=r+1;
r++;
}
}else{
ch=ch+'(';
pq.push(l);
l=r;
}
r++;
tot++;
}
ch+=')';
cout<<"! "<<ch<<" "<<endl;
}
return 0;
}
/*
10 9
((()())())
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |