# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
865475 | farica | Election (BOI18_election) | C++14 | 1231 ms | 28328 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>
#define long long ll
using namespace std;
const int MAX_N=1e6;
struct Node {
int sum, pref, suf, ans;
Node operator+(Node b) {
Node ret;
ret.sum = sum + b.sum;
ret.pref = max(pref, b.pref + sum);
ret.suf = max(b.suf, suf + b.sum);
ret.ans = max(max(ans + b.sum, b.ans + sum), pref + b.suf);
return ret;
}
};
string s;
Node seg[4*MAX_N];
int L,R;
void build(int node, int l, int r) {
if(l==r) {
if(s[l]=='T') seg[node].sum = seg[node].ans = seg[node].pref = seg[node].suf = 1;
else {
seg[node].sum = -1;
seg[node].pref = seg[node].suf = seg[node].ans = 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... |