# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
206891 | tuna | Split the sequence (APIO14_sequence) | C++11 | 79 ms | 131076 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 int long long
typedef pair <int, int> ii;
const int N = 1e5 + 5, oo = 1e18, K = 200;
int a[N], suf[N], pref[N], n, dp[2][N], trace[N][K];
struct Line {
int a, b, id;
Line() {}
Line(int _a, int _b, int _id) : a(_a), b(_b), id(_id) {}
int val(int x) {
return a * x + b;
}
};
struct CHT {
vector <Line> st;
CHT() {st.clear();}
bool bad(Line a, Line b, Line c) {
return (1.0 * (c.b - a.b) / (a.a - c.a) < 1.0 * (c.b - b.b) / (b.a - c.a));
}
void addLine(Line d) {
while (st.size() >= 2 && bad(d, st.back(), st[st.size() - 2])) {
// cerr << "delete Line y = " << st.back().a << "x + " << st.back().b << endl;
st.pop_back();
}
// cerr << "addLine y = " << d.a << "x + " << d.b << endl;
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... |