이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<iostream>
#include<algorithm>
#include"ricehub.h"
using namespace std;
int Sum[100005];
long long getCost(int st, int dr, int X[])
{
int poz=(st+dr)/2;
long long rez=-1LL*Sum[poz]+Sum[dr]-Sum[poz];;
if(st>0)
rez+=Sum[st-1];
if((dr-st+1)%2==1)
rez+=poz;
return rez;
}
int besthub(int N, int L, int X[], long long B)
{
Sum[0]=X[0];
for(int i=1; i<=N; i++)
Sum[i]=Sum[i-1]+X[i];
int st=0;
int rez=0;
for(int i=0; i<N; i++)
{
if(getCost(st,i,X)>B)
st++;
rez=max(rez,i-st+1);
}
return rez;
}
# | 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... |