#include <bits/stdc++.h>
using namespace std;
int main(){
int n,k; cin >> n>> k;
stack<int> aberto;
aberto.push(1);
string res = "(";
for(int i=2; i<=n; i++){
if(aberto.size() == 0){
aberto.push(i);
res += '(';
}
int aux = aberto.top();
cout << "? "<< aux << ' '<< i<< endl;
int ans; cin >> ans;
if(ans == 1){
aberto.pop();
res+=')';
}
else{
aberto.push(i);
res += '(';
}
}
cout << "! " << res << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
4 ms |
344 KB |
Answer length should be 1000, but it is 1001 |
3 |
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 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
578 ms |
1124 KB |
Answer length should be 100000, but it is 100001 |
3 |
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 |
- |