Submission #557189

#TimeUsernameProblemLanguageResultExecution timeMemory
557189n0sk1llRice Hub (IOI11_ricehub)C++14
17 / 100
15 ms1236 KiB
#include "ricehub.h" #include<bits/stdc++.h> using namespace std; long long int typedef li; int besthub(int n, int m, int x[], li b) { int mx=0,l=0,r=0; li t=0; for (int i=0;i<n;i++) if (t+(x[i]-x[0])<=b) t+=(x[i]-x[0]),r++; for (int i=1;i<n;i++) { t+=(2*i-l-r)*(x[i]-x[i-1]); while (t>b) t-=(x[i]-x[l]),l++; while (r<n && t+(x[r]-x[i])<=b) t+=(x[r]-x[i]),r++; mx=max(mx,r-l); } return mx; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...