# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
715559 |
2023-03-27T08:17:01 Z |
cbup |
Rice Hub (IOI11_ricehub) |
C++14 |
|
519 ms |
1108 KB |
#include<bits/stdc++.h>
using namespace std;
long long besthub(int n,int l,int x[],long long b){
long long cost,ans=0;
int mid;
vector<long long> prefixSum(l,0);
for(int i=1;i<=n;i++)prefixSum[i] = prefixSum[i-1]+x[i-1];
//for(int i=1;i<=n;i++)cout<<prefixSum[i]<<" "; cout<<endl;
for(int st=1;st<=n;st++){
for(int en=st;en<=n;en++){
mid = (st+en)/2;
cost = (mid-st)*x[mid]-(prefixSum[mid-1]-prefixSum[st-1]) + (prefixSum[en]-prefixSum[mid])-(en-mid)*x[mid];
if(cost <= b)ans = max(ans,en-st+1LL);
//cout<<st<<" "<<en<<" "<<cost<<endl;
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
519 ms |
1108 KB |
Output is correct |
2 |
Incorrect |
501 ms |
1108 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |