# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
528082 | sidon | Building Bridges (CEOI17_building) | C++17 | 60 ms | 36648 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 int int64_t
#define sp << ' ' <<
#define nl << '\n'
const int SZ = 1<<20, INF = 1e16;
struct Line {
int m = 0, c = INF;
Line() {}
int operator()(int x) { return m * x + c; }
};
Line s[SZ<<1], u;
void add(int x, int l, int r) {
int m = (l + r) / 2;
if(s[x](m) > u(m)) swap(u, s[x]);
if(r - l > 1)
u.m >= s[x].m ? add(2*x, l, m) : add(2*x+1, m, r);
}
const int Z = 1e5+1;
int N, h[Z], w[Z], dp[Z];
signed main() {
cin.tie(0)->sync_with_stdio(0);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |