Submission #382555

#TimeUsernameProblemLanguageResultExecution timeMemory
382555mewnianZagrade (COI20_zagrade)C++14
0 / 100
1 ms364 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...