Submission #1110657

#TimeUsernameProblemLanguageResultExecution timeMemory
1110657NomioWeighting stones (IZhO11_stones)C++17
100 / 100
30 ms5880 KiB
#include<bits/stdc++.h> #define meta int tm = tl + (tr - tl) / 2, x = (i << 1) + 1, y = x + 1 using namespace std; const int maxn = 1e5 + 1; int st[maxn * 4 + 1] {}, mn[maxn * 4 + 1] {}, mx[maxn * 4 + 1] {}; void update(int i, int tl, int tr, int X, int v) { if(tl == tr) { st[i] = mn[i] = mx[i] = v; return; } meta; if(X <= tm) update(x, tl, tm, X, v); else update(y, tm + 1, tr, X, v); st[i] = st[x] + st[y]; mn[i] = min(mn[x] + st[y], mn[y]); mx[i] = max(mx[x] + st[y], mx[y]); } int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; for(int i = 0; i < n; i++) { int a, t; cin >> a >> t; a--; if(t == 1) update(0, 0, n - 1, a, 1); else update(0, 0, n - 1, a, -1); if(mx[0] <= 0) cout << '<' << '\n'; else if(mn[0] >= 0) cout << '>' << '\n'; else cout << '?' << '\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...