# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
359695 | vkgainz | Election (BOI18_election) | C++17 | 746 ms | 43080 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 MX = 5e5 + 5;
struct node {
int sum, ans, mn, mx;
node() {
sum = 0, ans = 0, mn = 0, mx = 0;
}
node(int a, int b, int c, int d):
sum(a), ans(b), mn(c), mx(d)
{
}
} seg[4 * MX];
node comb(node &a, node &b) {
node ret;
ret.sum = a.sum+b.sum;
ret.mn = min(a.mn, b.mn + a.sum);
ret.mx = max(a.mx, b.mx + a.sum);
ret.ans = max({a.ans - b.sum, b.ans-a.sum, b.mx + a.sum - a.mn - ret.sum});
return ret;
}
int sz = 1;
void build(string &s, int n, int x=0, int lx=0, int rx=sz) {
if(rx-lx==1) {
if(lx<n) {
if(s[lx]=='C') seg[x] = node(1, -1, 0, 1);
else seg[x] = node(-1, 1, -1, 0);
}
else seg[x] = node();
return;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |