# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
969903 |
2024-04-25T19:13:25 Z |
urieg |
Rice Hub (IOI11_ricehub) |
C++17 |
|
1000 ms |
1112 KB |
#include <bits/stdc++.h>
#include "ricehub.h"
// for moondance
using namespace std;
typedef long long ll;
int besthub(int R, int L, int X[], long long B){
vector<ll>x(R), p(R);
for(int i=0;i<R;i++){
x[i] = X[i];
p[i] = x[i];
if(i)p[i] += p[i-1];
}
int ans = 0;
ll sum = 0;
int l = 0, r = 0;
for(int i =0;i<R;i++){
l = r = i;
sum = 0;
while(l>0 && r<R-1 && sum <= B){
if(l>0 && r<R-1){
if(x[i]-x[l-1] < x[r+1]-x[i]){
if(sum + x[i]-x[l-1] <= B){
sum += x[i]-x[l-1];
l--;
}
}
else{
if(sum + x[r+1]-x[i] <= B){
sum += x[r+1]-x[i];
r++;
}
}
}
else if(l>0){
if(sum + x[i]-x[l-1] <= B){
sum += x[i]-x[l-1];
l--;
}
}
else if(r<R-1){
if(sum + x[r+1]-x[i] <= B){
sum += x[r+1]-x[i];
r++;
}
}
}
ans = max(ans, r-l+1);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1012 ms |
344 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1034 ms |
344 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1014 ms |
344 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1027 ms |
1112 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |