# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
453589 | dutch | Weighting stones (IZhO11_stones) | C++17 | 36 ms | 3592 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
using T = array<int, 3>;
signed main(){
cin.tie(0)->sync_with_stdio(0);
int n, s = 1, i, v; cin >> n;
while((s+=s)<n);
T a[2*s];
fill(a, a+2*s, T{-1, 1, 0});
while(n--){
cin >> i >> v;
v = 2*v-3;
a[i+=s-1] = {v, v, v};
while(i/=2){
T &x = a[i+i], &y = a[i+i+1];
a[i] = {max(y[0], x[0] + y[2]), min(y[1], x[1] + y[2]), x[2] + y[2]};
}
if(a[1][1] >= 0) cout << "<\n";
else cout << char('>' + (a[1][0] > 0)) << '\n';
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |