# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1083143 | BLOBVISGOD | Election (BOI18_election) | C++17 | 296 ms | 30020 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;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define all(x) x.begin(),x.end()
#define sz(x) int(x.size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
struct segtree{
struct node{
int sm=0, L=0, R=0, A=0;
node operator+(node b){
return node{sm+b.sm,
max(L,sm+b.L),
max(b.R,b.sm+R),
max(max(sm+b.A,A+b.sm),L+b.R)};
}
};
int n;
vector<node> seg;
segtree(vi a){
n = 1;
while(n<sz(a))
n*=2;
seg.resize(n*2);
rep(i,0,sz(a)) seg[i+n] = {a[i],max(0,a[i]),max(0,a[i]),max(0,a[i])};
for(int i = n-1; i>0; --i) seg[i] = seg[i*2]+seg[i*2+1];
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |