# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
556777 | lunchbox | Distributing Candies (IOI21_candies) | C++17 | 314 ms | 29252 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.
/*
https://oj.uz/problem/view/IOI21_candies
Distributing Candies
*/
#include <bits/stdc++.h>
using namespace std;
#define N 200000
#define Q 200000
#define N_ (1 << 18) /* N_ = pow2(ceil(log2(N)) */
long long sum[N_ * 2], mn[N_ * 2], mx[N_ * 2]; int n_;
void pul(int i) {
int l = i << 1 | 0, r = i << 1 | 1;
sum[i] = sum[l] + sum[r];
mn[i] = min(mn[r], mn[l] + sum[r]);
mx[i] = max(mx[r], mx[l] + sum[r]);
}
void update(int i, int x) {
i |= n_;
sum[i] = x;
mn[i] = min(x, 0);
mx[i] = max(x, 0);
while (i > 1)
pul(i >>= 1);
}
# | 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... |