#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";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
344 KB |
Output is correct |
3 |
Correct |
25 ms |
344 KB |
Output is correct |
4 |
Correct |
31 ms |
344 KB |
Output is correct |
5 |
Correct |
75 ms |
344 KB |
Output is correct |
6 |
Correct |
109 ms |
344 KB |
Output is correct |
7 |
Runtime error |
1144 ms |
416 KB |
Execution killed with signal 13 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Mismatch at position 1. Expected ), found ( |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
344 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |