이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |