# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
20820 | kdh9949 | Split the sequence (APIO14_sequence) | C++14 | 613 ms | 88748 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;
typedef long long ll;
typedef pair<ll, int> pli;
struct Cht{
struct Line{
ll a, b; int x;
};
double cr(Line p, Line q){
return (q.b - p.b) * 1.0 / (p.a - q.a);
}
Line dq[100010];
int f, r;
void clr(){ f = r = 0; }
void upd(ll a, ll b, int x){
Line cur = {a, b, x};
while(f + 1 < r && ((dq[r - 1].a == cur.a && dq[r - 1].b <= cur.b) ||
(dq[r - 1].a != cur.a && cr(dq[r - 2], cur) <= cr(dq[r - 2], dq[r - 1])))) r--;
if(f == r || dq[r - 1].a != cur.a) dq[r++] = cur;
}
pli query(ll x){
while(f + 1 < r && x >= cr(dq[f], dq[f + 1])) f++;
return {dq[f].a * x + dq[f].b, dq[f].x};
}
}C;
int n, k, b[210][100010];
ll s[100010], dp[2][100010];
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... |