# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
533720 | 2022-03-07T04:05:50 Z | Gurban | Rice Hub (IOI11_ricehub) | C++17 | 4 ms | 696 KB |
#include <bits/stdc++.h> using namespace std; using ll = long long; const int maxn=1e5+5; ll p[maxn],b; int a[maxn]; bool check(int l,int r){ int md = (l + r) >> 1; ll val = 1ll * a[md] * (md - l); if(md-1 >= 0) val -= p[md-1]; if(l-1 >= 0) val += p[l-1]; val += p[r] - p[md]; val -= 1ll * a[md] * (r - md); return (val <= b); } int besthub(int R,int L,int X[],ll B){ for(int i = 0;i < R;i++) a[i] = X[i]; b = B; p[0] = X[0]; for(int i = 1;i < R;i++) p[i] = p[i - 1] + X[i]; int ans = 0; for(int i = 0;i < R;i++){ int l = 0,r = i - 1,md,jg=i; while(l <= r){ md = (l + r) >> 1; if(check(md,r)) jg=md,r=md-1; else l=md+1; } ans = max(ans,i-md+1); } return ans; } // int main(){ // ios::sync_with_stdio(false); // cin.tie(0); // int r,l,b; // int x[100]; // cin >> r >> l >> b; // for(int i = 0;i < r;i++) cin >> x[i]; // return cout<<besthub(r,l,x,b),0; // }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 696 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |