#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const ll MOD=1e9+7;
using namespace std;
ll N,M;
char ans[1005];
bool b[1005];
int main(){
cin>>N>>M;
if(M==N*N/4){
for(int i=1;i<=N;i++){
if(b[i]){
continue;
}
for(int j=i+1;j<=N;j+=2){
cout<<'?'<<' '<<i<<' '<<j<<endl;
ll x;
cin>>x;
if(x==1){
ans[i]='(';
ans[j]=')';
b[i]=true;
b[j]=true;
break;
}
}
}
string s={};
for(int i=1;i<=N;i++){
s+=ans[i];
}
cout<<"! "<<s<<endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
5 ms |
208 KB |
Output is correct |
3 |
Correct |
25 ms |
280 KB |
Output is correct |
4 |
Correct |
37 ms |
208 KB |
Output is correct |
5 |
Correct |
34 ms |
288 KB |
Output is correct |
6 |
Correct |
108 ms |
288 KB |
Output is correct |
7 |
Correct |
883 ms |
280 KB |
Output is correct |
8 |
Correct |
67 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Mismatch at position 1. Expected ), found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Unexpected end of file - token expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Unexpected end of file - token expected |
2 |
Halted |
0 ms |
0 KB |
- |