# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
285468 | arnold518 | Discharging (NOI20_discharging) | C++14 | 175 ms | 22500 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;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 1e6;
const ll INF = 1e15;
int N;
ll dp[MAXN+10], A[MAXN+10];
struct Line { ll a, b; };
double cross(Line p, Line q) { return (double)(q.b-p.b)/(p.a-q.a); }
struct CHT
{
int pos=0;
vector<Line> S;
void push(Line p)
{
while(S.size()>1 && cross(S[S.size()-1], S[S.size()-2])>=cross(S[S.size()-1], p)) S.pop_back();
S.push_back(p);
}
ll query(ll x)
{
if(pos>=S.size()) pos=S.size()-1;
else while(pos+1<S.size() && cross(S[pos], S[pos+1])<=x) pos++;
return S[pos].a*x+S[pos].b;
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... |