# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
746547 | cscandkswon | Split the sequence (APIO14_sequence) | C++17 | 1291 ms | 83812 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 <cstdio>
#include <algorithm>
using namespace std;
int N, K, v, w;
int A[100005];
long long S[100005];
long long D[100005][2];
int O[100005][205];
void dnc(int l, int r, int x, int y, int k) {
if (l > r) return;
int m = (l + r) >> 1;
int i, p;
long long q = 0;
for (i = max(k - 1, x); i <= min(y, m - 1); i++) {
if (q < (S[m] - S[i]) * (S[N] - S[m]) + D[i][w]) {
q = (S[m] - S[i]) * (S[N] - S[m]) + D[i][w];
p = i;
}
}
D[m][v] = q;
O[m][k] = p;
if (l == r) return;
dnc(l, m - 1, x, p, k);
dnc(m + 1, r, p, y, k);
}
void backtrack(int x, int k) {
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |