# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
590442 | Shreyan_Paliwal | Happiness (Balkan15_HAPPINESS) | C++17 | 1248 ms | 375488 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;
#define lg long long
struct Node {
lg l, r, val = 0;
Node* c[2] = { nullptr, nullptr };
Node* ML() {
if (c[0]) return c[0];
c[0] = new Node;
c[0]->l = l, c[0]->r = (l + r) >> 1;
return c[0];
}
Node* MR() {
if (c[1]) return c[1];
c[1] = new Node;
c[1]->l = ((l + r) >> 1) + 1, c[1]->r = r;
return c[1];
}
void upd(lg p, lg v) {
val += p * v;
if (l != r) {
lg mid = (l + r) >> 1;
if (p >= mid + 1)
MR()->upd(p, v);
else
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |