# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
722709 | drdilyor | Distributing Candies (IOI21_candies) | C++17 | 492 ms | 48652 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>
#include"candies.h"
using namespace std;
using ll = long long;
struct segtree {
struct node {
ll s{}, mx{}, mn{};
node operator+(const node& o) {
return node{s + o.s, max(o.mx, o.s + mx), min(o.mn, o.s + mn)};
}
};
int n;
vector<node> t;
segtree(int m) : n(m), t(m*4) {}
void upd(int i, int x) {
t[i += n] = node {x, max(0, x), min(0, x)};
for (i /= 2; i >= 1; i /= 2)
t[i] = t[i*2] + t[i*2+1];
}
node query(int l, int r) {
node resl, resr;
l += n; r += n;
while (l <=r) {
if (l%2==1) resl = resl + t[l++];
if (r%2==0) resr = t[r--] + resr;
l /= 2; r /= 2;
}
return resl + resr;
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |