Submission #167501

#TimeUsernameProblemLanguageResultExecution timeMemory
167501Toirov_SadiWeighting stones (IZhO11_stones)C++17
0 / 100
3 ms376 KiB
#include <bits/stdc++.h> #define fr first #define se second using namespace std; const long long N = 1e5 + 7; const long long inf = 1e9 + 7; const long long mod = 1e9 + 7; int n; int mn[4 * N]; int mx[4 * N]; int lazy[4 * N]; void push(int v, int tl, int tr){ if(tl != tr){ lazy[v * 2] += lazy[v]; lazy[v * 2 + 1] += lazy[v]; } mx[v] += lazy[v]; mn[v] += lazy[v]; lazy[v] = 0; } void upd(int v, int tl, int tr, int l, int r, int x){ if(l > r){ return; } if(tl == l && tr == r){ lazy[v] += x; push(v, tl, tr); return; } push(v, tl, tr); int tm = (tl + tr) / 2; upd(v * 2, tl, tm, l, min(r, tm), x); upd(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r, x); mx[v] = max(mx[v * 2], mx[v * 2 + 1]); mn[v] = min(mn[v * 2], mn[v * 2 + 1]); } int main() { /// freopen("input.txt", "r", stdin); /// freopen("output.txt", "w", stdout); ios_base::sync_with_stdio( false ); cin >> n; for(int i = 1; i <= n; i ++){ int x, t; cin >> x >> t; if(t == 1){ upd(1, 1, n, 1, x, 1); } else{ upd(1, 1, n, 1, x, -1); } if(mx[1] >= 0 && mn[1] >= 0){ cout << ">\n"; } else if(mx[1] <= 0 && mn[1] <= 0){ cout << "<\n"; } else{ cout << "?\n"; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...