# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
682965 | kusssso | Split the sequence (APIO14_sequence) | C++17 | 55 ms | 131072 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;
using ll = long long;
using ld = long double;
const int N = 1e5 + 5;
struct line {
ll A, B;
bool operator < (const line &oth) const {
return make_pair(A, B) < make_pair(oth.A, oth.B);
}
ld ins (line oth) {
return 1.0 * (oth.B - B) / (A - oth.A);
}
ll yy (ll x) {
return A * x + B;
}
};
struct convex_hull { // finding maximum
vector<line> hull;
bool ok (line l1, line l2, line l3) {
return l1.ins(l3) < l1.ins(l2);
}
void add (line d) {
while (hull.size() >= 2 && ok(hull[hull.size() - 2], hull[hull.size() - 1], d)) hull.pop_back();
while (!hull.empty() && hull.back().A == d.A) hull.pop_back(); // hull.back().B < d.B
hull.push_back(d);
}
ll query (ll x) {
# | 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... |