# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
28857 |
2017-07-17T11:07:03 Z |
inqr |
Rice Hub (IOI11_ricehub) |
C++14 |
|
1000 ms |
5924 KB |
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
int besthub(int R, int L, int X[], long long B)
// R toplam pirinc tarlasi sayisi
// L yolun uzunlugu
// X[] pirinc tarlalarinin kordinatlari
// B harciyabilecegin maksimum para
// optimal cozum her zaman bir tarlanin uzerinde
{
int ans=0;
for(int i=0;i<R;i++){
int cnt=1;
long long cost=0;
int il=i-1,ir=i+1;
while(X[i]==X[i+1]){i++;cnt++;ir=i+1;}
while(cost <= B){
int minn=INT_MAX,mp=0;
if(il>=0){minn=min(minn,X[i]-X[il]);mp=1;}
if(ir<R){minn=min(minn,X[ir]-X[i]);mp=2;}
if(cost+minn <= B){
cost+=minn;
cnt++;
il-= (mp==1) ? 1 : 0;
ir+= (mp==2) ? 1 : 0;
}
if(mp==0)break;
}
ans=max(ans,cnt);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
5924 KB |
Execution timed out |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
5924 KB |
Execution timed out |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
5924 KB |
Execution timed out |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
5924 KB |
Execution timed out |
2 |
Halted |
0 ms |
0 KB |
- |