# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
444027 | penguinhacker | Building Bridges (CEOI17_building) | C++14 | 83 ms | 8156 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 ll long long
#define ar array
const int mxN=1e5;
const ll INF=1e18;
int n, h[mxN], w[mxN];
struct Line {
ll m, b;
mutable ll p;
bool operator<(const Line& o) const { return m>o.m; }
bool operator<(ll x) const { return p<x; }
};
set<Line, less<>> s;
ll ix(set<Line>::iterator l1, set<Line>::iterator l2) {
assert(l1->m>l2->m);
ll x=l2->b-l1->b, y=l1->m-l2->m;
return x>=0?(x+y-1)/y:x/y;
}
bool bad(set<Line>::iterator it) {
assert(it!=s.end());
return it!=s.begin()&&next(it)!=s.end()&&ix(it, next(it))<=ix(prev(it), it);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |