제출 #502171

#제출 시각아이디문제언어결과실행 시간메모리
502171HappyPacManRice Hub (IOI11_ricehub)C++14
100 / 100
13 ms1740 KiB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;

int besthub(int R, int L, int X[], long long B){
    int res = 0;
    long long baht = 0;
    for(int i=0,j=0;i<R;i++){
        while(j+1 < R && baht + X[j+1]-X[(i+j+1)/2] <= B){
            baht += X[j+1]-X[(i+j+1)/2];
            j++;
            res = max(res,j-i+1);
        }
        baht -= X[(i+j+1)/2]-X[i];
    }
    return res;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...