# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1162403 | blackslex | Building Bridges (CEOI17_building) | C++20 | 42 ms | 9800 KiB |
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int n;
bool qrm;
struct line {
ll m, c;
mutable ll p;
line(ll p) : p(p) {}
line(ll m, ll c) : m(m), c(c) {}
friend bool operator < (const line &l1, const line &l2) {
return (qrm ? l1.p < l2.p : l1.m > l2.m);
}
};
struct convex:multiset<line> {
ll div (ll a, ll b) {
return (a / b) - ((a ^ b) < 0 && a % b);
}
bool ck (iterator x, iterator y) {
if (y == end()) return x->p = 1e18, 0;
if (x->m == y->m) x->p = x->c <= y->c ? 1e18 : -1e18;
else x->p = div(x->c - y->c, y->m - x->m);
return x->p >= y->p;
}
void add (ll m, ll c) {
auto y = insert(line(m, c)), x = y++;
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... |