# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
218236 | sunho0371 | Putovanje (COCI20_putovanje) | C++14 | 255 ms | 28432 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;
typedef long long ll;
struct segTree {
vector<int> tree, lazy;
int height, sz;
void init(int n) {
height = (int)ceil(log2(n));
sz = (1 << height);
tree.resize((1 << (height + 1)) + 1, 0);
lazy.resize((1 << (height + 1)) + 1, 0);
}
void updatelazy(int left, int right, int treepos) {
if (left != right) {
lazy[treepos * 2] += lazy[treepos] / 2;
lazy[treepos * 2 + 1] += lazy[treepos] / 2;
}
tree[treepos] += lazy[treepos];
lazy[treepos] = 0;
}
void updateAll(int left, int right, int treepos) {
if (lazy[treepos]) updatelazy(left, right, treepos);
if (left != right) {
int mid = (left + right) / 2;
updateAll(left, mid, treepos * 2);
updateAll(mid + 1, right, treepos * 2 + 1);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |