이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |