Submission #1005864

#TimeUsernameProblemLanguageResultExecution timeMemory
1005864hacizadalRice Hub (IOI11_ricehub)C++17
0 / 100
3 ms2488 KiB
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long #define pll pair<ll, ll> ll p[100005]; int besthub(int n, int k, int a[], long long b) { for (ll i = 0; i<n; i++){ p[i+1] = p[i] + a[i]; } ll l = 0, r = 0, mx = 0; while (r < n){ ll mid = (l + r)/2; ll sum = (p[r+1] - p[mid+1]) - a[mid]*(r-mid) + a[mid]*(mid-l) - (p[mid+1] - p[l+1]); if (sum <= b){ mx = max(mx, r-l+1); r++; } else { 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...