Submission #552493

#TimeUsernameProblemLanguageResultExecution timeMemory
552493SharkyRice Hub (IOI11_ricehub)C++17
100 / 100
19 ms2544 KiB
#include <bits/stdc++.h> using namespace std; long long pref[100005]; int besthub(int n, int m, int a[], long long b) { pref[0]=a[0]; for (long long i=1; i<n; i++) pref[i]=pref[i-1]+a[i]; long long ans=0; for (long long i=0; i<n; i++) { long long l=i, r=n-1; while (l<r) { long long mid=(l+r+1)/2; if (pref[mid]-pref[(i+mid)/2]-pref[(i+mid-1)/2]+(i==0?0:pref[i-1])<=b) l=mid; else r=mid-1; } ans=max(ans, l-i+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...