This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1005;
int marc[MAXN];
int main(){
int n,q; cin>>n>>q;
for(int i = 1; i <= n; i++){
if(marc[i])continue;
for(int j = i+1; j <= n; j++)
if(!marc[j]){
cout<<"? "<<i<<" "<<j<<endl;
int x; cin>>x;
if(x){
marc[j] = 1;
break;
}
}
}
cout<<"! ";
for(int i = 1; i <= n; i++){
if(marc[i] == 0)cout<<"(";
else cout<<")";
}cout<<"\n";
}
# | 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... |