# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
860851 | Blagoj | Election (BOI18_election) | C++17 | 444 ms | 76332 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define all(x) x.begin(), x.end()
struct Node {
ll sum, pref, suff, ans;
};
int n, arr[(int) 5e5 + 10];
struct SegmentTree {
vector<Node> sgt;
SegmentTree(int n) {
sgt.resize(4 * n);
}
Node merge(Node a, Node b) {
return { a.sum + b.sum, max(a.pref, a.sum + b.pref), max(b.suff, a.suff + b.sum), max({0LL, a.pref + b.suff, a.sum + b.ans, a.ans + b.sum}) };
}
void build(int k = 1, int l = 0, int r = n - 1) {
if (l == r) {
sgt[k] = { arr[l], max(0, arr[l]), max(0, arr[l]), max(arr[l], 0) };
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... |