이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "ricehub.h"
#include<bits/stdc++.h>
///Median
///Sliding window
///Determine the maximum number of reachable rice fields
using namespace std;
typedef long long ll;
#define debug(x) cout<<#x<<" = "<<x<<endl
int besthub(int N, int L, int X[], ll B)
{
ll cost=0;
int a=0,b=0;
int maximum=0;
while(b<N){
int mid;
if(cost<=B){
maximum=max(maximum,b-a+1);
b++;
mid=(a+b)/2;
if(b<N)
cost+=X[b]-X[mid];
}
else{
a++;
mid=(a+b)/2;
cost-=X[mid]-X[a-1];
}
}
return maximum;
}
# | 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... |