# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
631862 | czhang2718 | Election (BOI18_election) | C++17 | 460 ms | 28028 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=5e5;
int n, q;
string s;
struct Node{
int pre, suf, sum, ans;
Node operator+(Node b){
Node ret;
ret.pre=max(pre, sum+b.pre);
ret.suf=max(b.suf, b.sum+suf);
ret.sum=sum+b.sum;
ret.ans=max({ans+b.sum, b.ans+sum, pre+b.suf});
return ret;
}
} seg[4*N];
Node qry(int l, int r, int x=0, int lx=0, int rx=n){
if(lx>=l && rx<=r) return seg[x];
if(lx>=r || rx<=l) return {0, 0, 0, 0};
int m=(lx+rx)/2;
return qry(l, r, 2*x+1, lx, m)+qry(l, r, 2*x+2, m, rx);
}
void build(int x=0, int lx=0, int rx=n){
if(rx-lx==1){
if(s[lx]=='C') seg[x]={0, 0, -1, 0};
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |