제출 #61154

#제출 시각아이디문제언어결과실행 시간메모리
61154Vahan쌀 창고 (IOI11_ricehub)C++17
100 / 100
36 ms2684 KiB
#include "ricehub.h" #include<algorithm> #include<iostream> using namespace std; long long x[200000]; long long su[200000]; long long pat(long long l,long long r) { long long mid=(l+r)/2; return (mid-l+1)*x[mid]+su[l]-x[l]+su[r]-(r-mid)*x[mid]-2*su[mid]; } int besthub(int R, int L, int X[], long long B) { for(int r=0;r<R;r++) { x[r]=X[r]; if(r==0) su[r]=x[r]; else su[r]=su[r-1]+x[r]; } int l=0; int an=-1; long long q; for(int r=0;r<R;r++) { q=pat(l,r); while(q>B) { l++; q=pat(l,r); } q=pat(l,r); an=max(an,r-l+1); } return an; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...