이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "ricehub.h"
using namespace std;
int besthub(int R, int L, int X[], long long B)
{
if(R==1)
return 1;
if(B==0)
return 1;
long long b;
int sum = 0;
for(int x = 1; x<=L; x++)
{
b = B;
int l = x-1, r = x+1;
int res = 0;
while((r<R||l>=0)&&(b>=0))
{
if(l<0)
{
res++;
b-=abs(x-X[r]);
r++;
}
else if(r==R)
{
res++;
b-=abs(x-X[l]);
l--;
}
else if(abs(X[l]-x)<=abs(X[r]-x))
{
res++;
b-=abs(x-X[l]);
l--;
}
else if(abs(X[l]-x)>abs(X[r]-x))
{
res++;
b-=abs(x-X[r]);
r++;
}
}
sum = max(sum , res);
}
return sum;
}
| # | 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... |