제출 #1262943

#제출 시각아이디문제언어결과실행 시간메모리
1262943goulthenZagrade (COI20_zagrade)C++20
0 / 100
227 ms3540 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define pii pair<int, int> #define fi first #define se second #define rep(i, a, b) for (int i = a; i <= b; ++i) #define per(i, b, a) for (int i = b; i >= a; --i) #define pb push_back #define all(v) (v).begin(), (v).end() const int MAXN = 2e5 + 10; const int INF = 1e18 + 5; const int MOD = 1e9 + 7; int x[MAXN]; int query(int l, int r) { int ans; cout << "? " << l << " " << r << endl; cin >> ans; return ans; } int32_t main() { int n,q;cin >> n >> q; string pfx[n+10]; int ans = 0; int cl = 1, cr = 2; rep(i,1,n-1) { int x = query(cl,cr); if (x == 1) { pfx[cr] = ")"; pfx[cl] = "("; cr++; cl--; if (cr > n) break; if (cl < 1) { cl = cr; cr++; pfx[cl] = "("; } } else { pfx[cr] = "("; cl=cr; cr++; } } cout << "! "; rep(i,1,n) cout << pfx[i]; cout << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...