# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
684173 | sudheerays123 | Rice Hub (IOI11_ricehub) | C++17 | 14 ms | 1492 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll int
const ll N = 100+5 , INF = 1e9 , MOD = 1e9+7;
int besthub(int R, int L, int X[], long long B){
ll n = R;
vector<ll> a(n+5),presum(n+5);
for(ll i = 1; i <= n; i++){
a[i] = X[i-1];
presum[i] = presum[i-1]+a[i];
}
ll low = 1 , high = n;
ll ans;
function<bool(ll)> check = [&](ll l){
for(ll i = 1; i <= n-l+1; i++){
ll j = i+l-1;
ll mid = (i+j)/2;
long long cost = (mid-i)*a[mid]-presum[mid-1]+presum[i-1]+presum[j]-presum[mid]-(j-mid)*a[mid];
if(cost <= B) return true;
}
return false;
};
while(low <= high){
ll mid = (low+high)/2;
if(check(mid)){
ans = mid;
low = mid+1;
}
else high = mid-1;
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |