# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
674530 | alexdd | Election (BOI18_election) | C++17 | 486 ms | 29444 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.
#pragma GCC optimize("O3,unroll-loops")
#include<bits/stdc++.h>
using namespace std;
struct node
{
int max_pref;
int max_suff;
int sum;
int qry;
};
node combine(node x, node y)
{
node rez;
rez.sum = x.sum + y.sum;
rez.max_pref = max(x.max_pref, x.sum + y.max_pref);
rez.max_suff = max(y.max_suff, y.sum + x.max_suff);
rez.qry = max(x.max_pref + y.max_suff, max(x.qry + y.sum, y.qry + x.sum));
return rez;
}
node aint[2100001];
int n;
int v[500001];
void build(int nod, int st, int dr)
{
if(st==dr)
{
int x;
if(v[st]==1) x=1;
else x=0;
aint[nod]={max(0,v[st]),max(0,v[st]),v[st],x};
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |