# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
426792 | oleh1421 | Building Bridges (CEOI17_building) | C++17 | 74 ms | 7496 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.
//#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
typedef pair<ll,ll> line;
const int N=1000010;
const ll mod=1000000007;
const ll inf=1e15;
ll h[N],w[N];
ll dp[N];
ll a[N],b[N];
line t[N];
ll f(line cur,ll x){
return cur.first*x+cur.second;
}
int TOT=1;
int L[N],R[N];
void upd(int v,int l,int r,line cur){
// cout<<v<<" "<<l<<" "<<r<<endl;
ll mid=(l+r)/2;
if (f(t[v],mid)>f(cur,mid)) swap(t[v],cur);
if (cur.second==inf || l==r) return;
if (f(t[v],l)>f(cur,l)){
if (!L[v]) {
L[v]=++TOT;
t[TOT]={1e9,inf};
}
upd(L[v],l,mid,cur);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |