# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
641953 | SirCovidThe19th | Building Bridges (CEOI17_building) | C++17 | 97 ms | 8408 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
template<class T> struct lichao{
struct line{
T m, b;
T operator()(T x){ return m * x + b; }
};
lichao(){ extend(0); extend(0); }
const T lim = 1e18; vector<line> seg; vector<int> lc, rc;
int extend(int i){
if (i) return i;
seg.push_back({0, lim}); lc.push_back(0); rc.push_back(0);
return seg.size() - 1;
}
void upd(line S, int l = 0, int r = 1e6+5, int i = 1){
if (S.b == lim) return;
if (l == r){ seg[i] = (S(l) < seg[i](l)) ? S : seg[i]; return; }
if (seg[i].m > S.m) swap(seg[i], S);
int mid = (l + r) / 2 - (l + r < 0 and (l + r) % 2);
if (S(mid) < seg[i](mid)){
swap(S, seg[i]);
upd(S, mid + 1, r, rc[i] = extend(rc[i]));
}
else upd(S, l, mid, lc[i] = extend(lc[i]));
}
T qry(int x, int l = 0, int r = 1e6+5, int i = 1){
if (x < l or x > r or !i) return lim;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |