제출 #218755

#제출 시각아이디문제언어결과실행 시간메모리
218755Andrei_Cotor쌀 창고 (IOI11_ricehub)C++11
0 / 100
9 ms640 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...