# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1032623 |
2024-07-24T04:21:12 Z |
ezzzay |
Rice Hub (IOI11_ricehub) |
C++14 |
|
3 ms |
612 KB |
#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define ll long long
int besthub(int R, int L, int X[], long long B)
{
int n=R;
int ans=0;
for(int i=0;i<n;i++){
int l=-1,r=i+1;
ll k=B;
int cnt=0;
while(1){
if(l==-1 and r==n)break;
if(l==-1){
if(abs(X[r]-X[i])<=k){
cnt++;
k-=abs(X[r]-X[i]);
r++;
}
else{break;}
}
else if(r==n){
if(abs(X[l]-X[i])<=k){
cnt++;
k-=abs(X[l]-X[i]);
l--;
}
else{break;}
}
else{
ll a=abs(X[r]-X[i]),b=abs(X[l]-X[i]);
if(a<=b){
if(abs(X[r]-X[i])<=k){
cnt++;
k-=abs(X[r]-X[i]);
r++;
}
else{break;}
}
else{
if(abs(X[l]-X[i])<=k){
cnt++;
k-=abs(X[l]-X[i]);
l--;
}
else{break;}
}
}
}
ans=max(ans,cnt);
}
return ans+1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
612 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |