Submission #336946

#TimeUsernameProblemLanguageResultExecution timeMemory
336946BY_KUTBILIMWeighting stones (IZhO11_stones)C++14
100 / 100
288 ms4588 KiB
/** @BY_KUTBILIM **/ #include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define pb push_back #define ll long long const int N = (int)1e6 + 12; int mx[N], mn[N], add[N]; void push(int v, int l, int r){ if(add[v] != 0){ if(l != r){ add[v*2] += add[v]; add[v*2+1] += add[v]; } mx[v] += add[v]; mn[v] += add[v]; add[v] = 0; } } void update(int v, int tl, int tr, int l, int r, int val){ push(v, tl, tr); if(tr < l || tl > r)return ; if(l <= tl and tr <= r){ add[v] += val; push(v, tl, tr); return ; } int tm = (tl + tr) / 2; update(v*2, tl, tm, l, r, val); update(v*2+1, tm+1, tr, l, r, val); mx[v] = max(mx[v*2], mx[v*2+1]); mn[v] = min(mn[v*2], mn[v*2+1]); } int main(){ ios_base::sync_with_stdio(false); cin.tie(); int n; cin >> n; int t = n; while(t--){ int r, s; cin >> r >> s; if(s == 1){ update(1, 1, n, 1, r, 1); } else{ update(1, 1, n, 1, r, -1); } if(mx[1] >= 0 and mn[1] >= 0){ cout << ">\n"; } else if(mx[1] <= 0 and mn[1] <= 0){ cout << "<\n"; } else cout << "?\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...