#include <bits/stdc++.h>
using namespace std;
#define int long long
#define OYY 10000000005
#define mod 1000000007
char dizi[100005];
vector <int> q;
int sor(int x,int y){
cout<<"? "<<x<<" "<<y;
cout<<'\n';
int m;cin>>m;
return m;
}
int32_t main(){
int n,k;cin>>n>>k;
dizi[1]='(';
q.push_back(1);
for(int i=2;i<=n;i++){
if(q.size() && sor(q.back(),i)){
dizi[i]=')';
q.pop_back();
}
else{
dizi[i]='(';
q.push_back(i);
}
}
int gec=q.size()/2;
for(int i=0;i<gec;i++){
dizi[q[i]]='(';
}
cout<<"! ";
for(int i=1;i<=n;i++)cout<<dizi[i]<<"";
cout<<'\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
3 ms |
208 KB |
Output is correct |
3 |
Correct |
6 ms |
208 KB |
Output is correct |
4 |
Correct |
8 ms |
208 KB |
Output is correct |
5 |
Correct |
5 ms |
208 KB |
Output is correct |
6 |
Correct |
5 ms |
208 KB |
Output is correct |
7 |
Correct |
8 ms |
312 KB |
Output is correct |
8 |
Correct |
10 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 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
305 ms |
372 KB |
Output is correct |
3 |
Correct |
661 ms |
424 KB |
Output is correct |
4 |
Correct |
589 ms |
476 KB |
Output is correct |
5 |
Correct |
735 ms |
504 KB |
Output is correct |
6 |
Correct |
818 ms |
604 KB |
Output is correct |
7 |
Correct |
674 ms |
944 KB |
Output is correct |
8 |
Correct |
634 ms |
492 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Mismatch at position 1. Expected ), found ( |
2 |
Halted |
0 ms |
0 KB |
- |