# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
470200 | keta_tsimakuridze | Discharging (NOI20_discharging) | C++14 | 606 ms | 23768 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>
#define f first
#define s second
#define int long long
#define pii pair<int,int>
using namespace std;
const int N = 1e6 + 5, inf = 1e9 + 7; // !
int t,r[N],a[N],n, le_[30 * N], ri_[30*N], cur;
pii tree[30 * N];
int f(int k,int x,int b) {
return k * x + b;
}
void insert(int u,int l,int r,int k,int b) {
if(l == r) {
if(f(tree[u].f,l,tree[u].s) > f(k,l,b)) tree[u] = {k,b};
return;
}
int mid = (l + r)/2;
if(k < tree[u].f) swap(tree[u].f,k), swap(tree[u].s,b);
if(f(k,mid,b) <= f(tree[u].f,mid,tree[u].s)) {
if(!ri_[u]) ri_[u] = ++cur, tree[cur] = tree[u];
else insert(ri_[u],mid + 1,r, tree[u].f, tree[u].s);
tree[u] = {k,b};
}
else {
if(!le_[u]) le_[u] = ++cur, tree[cur] = {k,b};
else insert(le_[u],l,mid,k,b);
}
}
int get(int u,int l,int r,int id) {
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |