#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long ll;
const ll MAXN = 2e5 + 7;
const ll INV = 202;
const ll MOD = 2019;
int n, q;
void solvebrute()
{
}
void solveac()
{
cout << "? " << 1 << ' ' << n << endl;
string ans = "(";
int rs; cin >> rs;
if (!rs)
{
for (int i = 0; i < n; ++i) ans += '(';
cout << ans << endl;
return;
}
int l = 2, r = 3;
while (r < n)
{
cout << "? " << l << ' ' << r << endl;
cin >> rs;
if (rs)
{
int sz = (r - l + 1) / 2;
for (int i = 0; i < sz; ++i) ans += '(';
for (int i = 0; i < sz; ++i) ans += ')';
l = r + 1, r = l + 1;
continue;
}
r += 2;
}
ans += ')';
cout << ans << endl;
}
int main()
{
ios_base::sync_with_stdio(0); cout.tie(0);
// #ifdef OFFLINE
// freopen("input.inp", "r", stdin);
// #endif
cin >> n >> q;
solveac();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Incorrect query () |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Incorrect query ((( |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Incorrect query (()) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Incorrect query ((((( |
2 |
Halted |
0 ms |
0 KB |
- |