Submission #901412

#TimeUsernameProblemLanguageResultExecution timeMemory
901412LOLOLOWeighting stones (IZhO11_stones)C++14
100 / 100
52 ms5720 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define sz(x) (int)(x).size() #define len(x) (int)(x).length() #define cntbit(x) builtin_popcnt(x) #define f first #define s second #define pb push_back const int N = 1e5 + 100; pair <int, int> seg[N * 4]; int laz[N * 4]; void push(int id) { int t = laz[id]; laz[id * 2] += t; laz[id * 2 + 1] += t; seg[id * 2].f += t, seg[id * 2].s += t, seg[id * 2 + 1].f += t, seg[id * 2 + 1].s += t; laz[id] = 0; } void upd(int id, int l, int r, int u, int v, int add) { if (l > v || r < u) return; if (l >= u && r <= v) { laz[id] += add; seg[id].f += add, seg[id].s += add; return; } push(id); int m = (l + r) / 2; upd(id * 2, l, m, u, v, add); upd(id * 2 + 1, m + 1, r, u, v, add); seg[id].f = max(seg[id * 2].f, seg[id * 2 + 1].f); seg[id].s = min(seg[id * 2].s, seg[id * 2 + 1].s); } char check() { if (seg[1].s >= 0) { return '>'; } if (seg[1].f <= 0) { return '<'; } return '?'; } ll solve() { int n; cin >> n; for (int i = 0; i < n; i++) { int r, s; cin >> r >> s; r = n - r + 1; if (s == 1) { upd(1, 1, n, r, n, 1); } else { upd(1, 1, n, r, n, -1); } cout << check() << '\n'; } return 0; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t = 1; //cin >> t; while (t--) { solve(); //cout << solve() << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...