# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1060070 | thangdz2k7 | Distributing Candies (IOI21_candies) | C++17 | 210 ms | 41424 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;
const int N = 2e5 + 5;
int n, q;
vector <int> event[N];
long long sum[4 * N], Max[4 * N], Min[4 * N];
void upd(int u, int val, int s = 1, int l = 0, int r = q - 1){
if (l == r){
sum[s] = val;
Max[s] = max(0, val);
Min[s] = min(0, val);
return;
}
int mid = l + r >> 1;
if (mid >= u) upd(u, val, 2 * s, l, mid);
else upd(u, val, 2 * s + 1, mid + 1, r);
sum[s] = sum[2 * s] + sum[2 * s + 1];
Max[s] = max(Max[2 * s], sum[2 * s] + Max[2 * s + 1]);
Min[s] = min(Min[2 * s], sum[2 * s] + Min[2 * s + 1]);
}
long long get(int time, int s = 1, int l = 0, int r = q - 1){
if (l == r){
if (sum[s] < 0) return 0;
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |