# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
956232 | Iwanttobreakfree | Election (BOI18_election) | C++17 | 484 ms | 28136 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 max_n = 5e5+2;
struct Node{
int l = 0, r = 0, sum = 0, sol = 0;
};
Node t[4*max_n];
// a > 0, a tiene t[a] platos sin pagar
Node merge(Node a, Node b) {
Node ans;
ans.l = max(a.l, a.sum+b.l);
ans.r = max(b.r, b.sum+a.r);
ans.sum = a.sum+b.sum;
ans.sol = max(a.l+b.r, max(a.sum+b.sol, a.sol+b.sum));
return ans;
}
Node updateN(Node x, int p) {
if (p > 0) x.l = x.r = x.sum = x.sol = x.sum+p;
else x.sum += p;
return x;
}
void update_p(int n, int l, int r, int p, int x) {
if (l > p || r < p) return;
if (l == r) {
t[n] = updateN(t[n],x);
}
else {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |