# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
13457 | ainta | 수열 (APIO14_sequence) | C++98 | 1823 ms | 89064 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<stdio.h>
int n, k, w[101000], top;
int Path[210][101000];
long long S[101000], D[2][101000];
struct Stack{
long long a, b;
int pv;
}st[101000];
void Add(long long a, long long b, int pv){
while (top > 1 && (double)(st[top - 1].b - b) / (a - st[top - 1].a) <= (double)(st[top - 1].b - st[top].b) / (st[top].a - st[top - 1].a))top--;
if (top && st[top].a == a){
if (st[top].b < b)st[top].b = b;
return;
}
top++;
st[top].a = a, st[top].b = b, st[top].pv = pv;
}
long long Gap(int t, long long x){
return st[t].a*x + st[t].b;
}
long long Do(long long x){
int be = 1, ed = top - 1, mid, r = top;
while (be <= ed){
mid = (be + ed) >> 1;
if (Gap(mid, x) >= Gap(mid + 1, x)){
r = mid;
ed = mid - 1;
}
else{
be = mid + 1;
# | 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... |