#include "ricehub.h"
#include <iostream>
using namespace std;
#define ll long long
int besthub(int R, int L, int X[], long long B)
{
ll ans = 0;
for(ll i=0;i<R;i++){
ll temp_counter=0;
ll temp_pos=0;
ll cur_cost = 0;
ll prev_pos = 0;
for(ll j=i;j<R;j++){
prev_pos = temp_pos;
temp_pos = ((temp_pos * temp_counter) + X[j]) / (temp_counter+1);
cur_cost += abs(prev_pos-temp_pos)*temp_counter;
cur_cost += X[j] - temp_pos;
temp_counter ++;
if(cur_cost <= B){
ans=max(ans,(j-i)+1);
}else{
break;
}
// cout << temp_counter << " " << temp_pos << " " << cur_cost << endl;
}
}
// cout << ans << endl;
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
304 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
312 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
10 ms |
468 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |