# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
166413 | Dovran | Weighting stones (IZhO11_stones) | C++11 | 499 ms | 5628 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>
#define N 100009
#define pii pair <int, int>
#define ff first
#define ss second
#define pb push_back
#define ll long long
using namespace std;
int n, v[4*N][3], c[4*N];
void upd(int nd, int l, int r, int x, int y){
if(v[nd/2][2]!=0)
v[nd][2]+=v[nd/2][2], v[nd][1]+=v[nd/2][2], c[nd]+=v[nd/2][2];
if(l>x)
return;
if(r<=x){
v[nd][2]+=y;
v[nd][1]+=y, c[nd]+=y;
return;
}
int md=(l+r)/2;
upd(nd*2, l, md, x, y);
upd(nd*2+1, md+1, r, x, y);
v[nd][1]=max(v[nd*2][1], v[nd*2+1][1]);
c[nd]=min(c[nd*2], c[nd*2+1]);
v[nd][2]=0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |