제출 #425250

#제출 시각아이디문제언어결과실행 시간메모리
425250chirathnirodha쌀 창고 (IOI11_ricehub)C++17
100 / 100
23 ms1752 KiB
//Coded by Chirath Nirodha #include<bits/stdc++.h> #include "ricehub.h" #define F first #define S second #define PB push_back #define MP make_pair #define P push #define I insert typedef long long ll; typedef long double ld; typedef unsigned long long ull; using namespace std; const ll mod=1e9+7; int besthub(int R, int L, int X[], long long B){ int n=R; ll ans=1; ll l=0,r=0,cur=0; while(l<n && r<n){ if(cur<=B){ if(r==n-1)break; int m=(l+r+1)/2; cur+=(long long) X[r+1]-(long long) X[m]; r++; } else{ if(l==n-1)break; int m=(l+r+1)/2; cur-=(long long) X[m]-(long long) X[l]; l++; } if(cur<=B)ans=max(ans,r-l+1); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...