Submission #201233

#TimeUsernameProblemLanguageResultExecution timeMemory
201233DavidDamianRice Hub (IOI11_ricehub)C++11
100 / 100
24 ms760 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...