#include <bits/stdc++.h>
using namespace std;
int marc[1005];
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<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
344 KB |
Output is correct |
3 |
Correct |
18 ms |
344 KB |
Output is correct |
4 |
Correct |
33 ms |
344 KB |
Output is correct |
5 |
Correct |
87 ms |
344 KB |
Output is correct |
6 |
Correct |
100 ms |
344 KB |
Output is correct |
7 |
Runtime error |
1071 ms |
416 KB |
Execution killed with signal 13 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 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 |
- |