# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1141588 | omsincoconut | Food Court (JOI21_foodcourt) | C++20 | 299 ms | 31920 KiB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
const int MAXN = 250005, MAXT = 4*MAXN+5;\
const pll NULLPAIR = make_pair(0LL, 0LL);
pll op1(pll a, pll b) {
// The pairs are (-, +)
if (a.second >= b.first) return make_pair(a.first, a.second-b.first+b.second);
else return make_pair(a.first-a.second+b.first, b.second);
}
struct max0_segtree{
pll tree[MAXT];
pll lz[MAXT];
void init() {
fill(tree, tree+MAXT, NULLPAIR);
fill(lz, lz+MAXT, NULLPAIR);
}
void push(int v, int l, int r) {
tree[v] = op1(tree[v], lz[v]);
if (l < r) {
lz[v<<1] = op1(lz[v<<1], lz[v]);
lz[(v<<1)+1] = op1(lz[(v<<1)+1], lz[v]);
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |