Submission #1003111

#TimeUsernameProblemLanguageResultExecution timeMemory
1003111vjudge1Rice Hub (IOI11_ricehub)C++17
68 / 100
1027 ms2136 KiB
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; #define ll long long const int N = 1e5 + 5; int a[N]; int b; int besthub(int n, int L, int X[], ll B){ int ans = 0, cur = 0, cnt = 0; for(int i = 0; i < n; ++i) a[i] = X[i]; for(int i = 0; i < n; ++i) { int l = i, r = i + 1; cur = 0,cnt = 0; while(l >= 0 || r < n){ if((l >= 0 && a[i] - a[l] < a[r] - a[i]) || (r >= n)){ cur += a[i] - a[l]; --l; } else { cur += a[r] - a[i]; ++r; } if(cur > B) { break; } cnt++; } ans = max(ans,cnt); } 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...