# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
384261 | danielcm585 | Split the sequence (APIO14_sequence) | C++14 | 1492 ms | 81900 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 fi first
#define se second
typedef long long ll;
typedef pair<int,int> ii;
const int N = 1e5;
const int K = 2e2;
const ll INF = 1e18;
int n, k;
int a[N+2];
int bt[K+2][N+2];
ll sum[N+2];
ll dp[2][N+2];
ll cost(int l, int r) {
return (sum[r]-sum[l-1])*sum[l-1];
}
void compute(int id, int l, int r, int x, int y) {
if (l > r) return;
int mid = (l+r)/2, opt = -1;
dp[id&1][mid] = -INF;
for (int i = x; i <= min(y,mid); i++) {
if (dp[id&1][mid] < dp[id&1^1][i-1]+cost(i,mid)) {
dp[id&1][mid] = dp[id&1^1][i-1]+cost(i,mid);
bt[id][mid] = i-1;
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... |