# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
848845 | 2023-09-13T15:48:39 Z | Mr_Ph | Rice Hub (IOI11_ricehub) | C++14 | 3 ms | 856 KB |
#include "ricehub.h" //#include "grader.cpp" #include <bits/stdc++.h> #define ll long long #define sz size() using namespace std; int besthub(int r, int l, int arr[], long long b) { int p1=0,p2=0; vector<int>prf(r); prf[0]=arr[0]; for(int i=1;i<r;i++) prf[i]=prf[i-1]+arr[i]; int ans=0,ans1=0; while(p1<r) { while(p2<r) { int idx=(l+r)/2; int left=(idx==0?0:prf[idx]),right=prf[p2]-prf[idx]; if(p1!=0)left-=prf[p1-1]; int val=arr[idx]; left=val*(idx-p1)-left; right-=val*(r-idx); if(right+left<=b){ ans=max(ans,(p2-p1+1)); p2++; } else break; } p1++; } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 504 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 856 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |