# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1173640 | ivaziva | Split the sequence (APIO14_sequence) | C++20 | 3 ms | 4416 KiB |
#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define MAXN 100001
#define MAXM 201
#define int long long
const int INF = LLONG_MAX;
struct LiChaoTree {
struct Line {
int m, b;
Line(int _m = 0, int _b = -INF) : m(_m), b(_b) {}
int eval(int x) { return m * x + b; }
};
vector<Line> tree;
int minX, maxX, sz;
LiChaoTree(int _minX, int _maxX) : minX(_minX), maxX(_maxX) {
sz = 1;
while (sz < (maxX - minX + 1)) sz *= 2;
tree.assign(2 * sz, Line());
}
void addLine(Line newLine, int node = 1, int l = 0, int r = -1) {
if (r == -1) r = sz - 1;
int mid = (l + r) / 2;
bool leftBetter = newLine.eval(l + minX) > tree[node].eval(l + minX);
# | 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... |