Submission #998880

#TimeUsernameProblemLanguageResultExecution timeMemory
998880Mr_HusanboyRice Hub (IOI11_ricehub)C++17
68 / 100
1094 ms3692 KiB
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; #define ll long long int besthub(int n, int lim, int a[], long long cost) { int ans = 0; for(int i = 0; i < n; i ++){ int l = i, r = i + 1; ll cur = 0; int 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 > cost) 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...