# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
112349 | ainta | Split the sequence (APIO14_sequence) | C++17 | 560 ms | 6620 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>
#include<vector>
#define N_ 101000
using namespace std;
int n, K, w[N_], MnC[N_], MxC[N_], MxP[N_], MnP[N_];
long long S[N_], D[N_];
struct Seg {
long long A, B;
int num;
}Deq[N_];
bool Over(Seg a, Seg b, Seg c) {
if (a.A == b.A) return true;
long long A = b.B - a.B, B = a.A - b.A, C = c.B - a.B, D = a.A - c.A;
if (A/B != C/D)return A/B >= C/D;
A %= B, C %= D;
return A * D >= B * C;
}
long long Get(Seg a, long long x) {
return a.A*x + a.B;
}
void Calc(long long M) {
int i;
int head = 1, tail = 0;
Deq[++tail] = { 0,0,0 };
for (i = 1; i <= n; i++) {
while (head < tail && Get(Deq[head], S[i]) >= Get(Deq[head + 1], S[i]))head++;
MxC[i] = MxC[Deq[head].num] + 1;
MxP[i] = Deq[head].num;
D[i] = Get(Deq[head], S[i]) + S[i] * S[i] + M;
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... |