# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
616038 | penguinhacker | Distributing Candies (IOI21_candies) | C++17 | 160 ms | 82004 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 "candies.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ar array
const int mxN=2e5;
const ar<ll, 5> ID={-1, -1, -1, -1, -1};
// store {sum, min, max, up, down}
int n, q;
vector<int> queries[mxN];
ar<ll, 5> st[1<<19];
ar<ll, 5> mk(int x) {
return {x, x, x, max(0, x), min(0, x)};
}
ar<ll, 5> cmb(ar<ll, 5> a, ar<ll, 5> b) {
if (a==ID||b==ID)
return a!=ID?a:b;
return {
a[0]+b[0],
min(a[1], a[0]+b[1]),
max(a[2], a[0]+b[2]),
max({a[3], b[3], a[0]+b[2]-a[1]}),
min({a[4], b[4], a[0]+b[1]-a[2]})
};
}
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... |