# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
123816 | FutymyClone | Building Bridges (CEOI17_building) | C++14 | 40 ms | 3704 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;
const int N = 1e5 + 5;
const long long inf = 1LL << 62;
int n, h[N], w[N];
long long dp[N], f[N];
int state (int a, int b) {
return a > b ? 1 : (a < b ? -1 : 0);
}
struct ConvexHullTrick {
struct Line {
long long a, b; // y = ax + b
mutable function <const Line*()> succ;
Line (long long a, long long b): a(a), b(b) {};
bool operator < (const Line &rhs) const {
if (rhs.b != inf) return a < rhs.a;
const Line* s = succ();
if (!s) return false;
int x = rhs.a;
return b - s -> b < (s -> a - a) * x;
}
};
multiset <Line> s;
bool bad (multiset <Line> ::iterator x) {
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... |