# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1160057 | qwert1234asd | Split the sequence (APIO14_sequence) | C++20 | 311 ms | 81804 KiB |
// Check if the reference code is correct
// https://usaco.guide/problems/apio-2014split-the-sequence/solution
#include <bits/stdc++.h>
#define FOR(i, x, y) for (int i = x; i < y; i++)
typedef long long ll;
using namespace std;
int n, k;
int where[201][100001];
ll pref[100001]{0}, dp[2][100001], q[100001], l = 1, r = 1;
bool case1(int x, int y, int c) {
return (dp[0][y] - dp[0][x] >= (pref[y] - pref[x]) * (pref[n] - pref[c]));
}
bool case2(int x, int y, int c) {
return ((dp[0][y] - dp[0][x]) * (pref[c] - pref[y]) <= (dp[0][c] - dp[0][y]) * (pref[y] - pref[x]));
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> k;
FOR(i, 1, n + 1) {
int x;
cin >> x;
pref[i] = pref[i - 1] + x;
}
fill(dp[0], dp[0] + n + 1, 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |