# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
240932 | kimbj0709 | Building Bridges (CEOI17_building) | C++14 | 109 ms | 16168 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define maxn 100050
vector<int> vect3;
struct Line {
int m, b;
int operator()(int x) { return m * x + b; }
} a[maxn*4];
void insert(int l, int r, Line seg, int o) {
if(l==r) {
if(seg(vect3[l]) > a[o](vect3[l])) a[o] = seg;
return;
}
int mid= (l + r) >> 1, lson = o * 2 + 1, rson = o * 2 + 2;
if(a[o].m > seg.m) swap(a[o], seg);
if(a[o](vect3[mid]) < seg(vect3[mid])) {
swap(a[o], seg);
insert(l, mid, seg, lson);
}
else insert(mid+1, r, seg, rson);
}
int query(int l, int r, int x, int o) {
if(l==r) return a[o](vect3[x]);
int mid = (l + r) >> 1, lson = o * 2 + 1, rson = o * 2 + 2;
if(x < mid) return max(a[o](vect3[x]), query(l, mid, x, lson));
else return max(a[o](vect3[x]), query(mid+1, r, x, rson));
}
int32_t main() {
ios::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... |