Submission #1092117

#TimeUsernameProblemLanguageResultExecution timeMemory
1092117juicyWeighting stones (IZhO11_stones)C++17
100 / 100
27 ms4460 KiB
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "debug.h" #else #define debug(...) 42 #endif const int N = 1e5 + 5; int n; int s[4 * N], mn[4 * N], mx[4 * N]; void upd(int i, int x, int id = 1, int l = 1, int r = n) { if (l == r) { s[id] = mn[id] = mx[id] = x; return; } int m = (l + r) / 2; if (i <= m) { upd(i, x, id * 2, l, m); } else { upd(i, x, id * 2 + 1, m + 1, r); } s[id] = s[id * 2] + s[id * 2 + 1]; mn[id] = min(mn[id * 2] + s[id * 2 + 1], mn[id * 2 + 1]); mx[id] = max(mx[id * 2] + s[id * 2 + 1], mx[id * 2 + 1]); } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> n; for (int i = 0; i < n; ++i) { int r, s; cin >> r >> s; upd(r, s == 1 ? 1 : -1); cout << (mx[1] <= 0 ? '<' : (mn[1] >= 0 ? '>' : '?')) << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...