# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
13247 | baneling100 | Weighting stones (IZhO11_stones) | C++98 | 61 ms | 4156 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 <stdio.h>
#include <algorithm>
using namespace std;
int N, R, S, M, Value, Max[262144], Min[262144], Idx[262144];
void SegTree(int Left, int Right, int Loc) {
int Mid = (Left + Right) / 2;
if(Right <= R) {
Max[Loc] += Value;
Min[Loc] += Value;
Idx[Loc] += Value;
}
else {
Max[2 * Loc] += Idx[Loc];
Min[2 * Loc] += Idx[Loc];
Idx[2 * Loc] += Idx[Loc];
Max[2 * Loc + 1] += Idx[Loc];
Min[2 * Loc + 1] += Idx[Loc];
Idx[2 * Loc + 1] += Idx[Loc];
Idx[Loc] = 0;
SegTree(Left, Mid, 2 * Loc);
if(Mid + 1 <= R)
SegTree(Mid + 1, Right, 2 * Loc + 1);
Max[Loc] = max(Max[2 * Loc], Max[2 * Loc + 1]);
Min[Loc] = min(Min[2 * Loc], Min[2 * Loc + 1]);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |