Submission #417815

#TimeUsernameProblemLanguageResultExecution timeMemory
417815ioiRice Hub (IOI11_ricehub)C++14
0 / 100
3 ms716 KiB
#include "ricehub.h" #include<bits/stdc++.h> using namespace std ; int besthub(int R, int L, int X[], long long B) { int mx = 0 ; int e[R + 10] = {}; for(int i = 0 ; i < R ; i ++) e[X[i]] ++ ; for(int i = 1 ; i <= L ; i ++){ int sum = B ; int ans = 0 ; int pl = i , pr = i; int d = 0 ; while(sum > 0 && (pl >=0 || pr < R + 9) ){ d ++ ; pl -- , pr ++ ; if(pl >= 0 && e[pl]){ if(sum > d)ans ++ , sum -= d ; else break; } if(pr < L + 9 && e[pr]){ if(sum > d)ans ++ , sum -= d ; else break; } } mx = max(mx , ans); } 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...