| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 115838 | dolphingarlic | 쌀 창고 (IOI11_ricehub) | C++14 | 18 ms | 2560 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "ricehub.h"
#include <algorithm>
typedef long long LL;
LL all[100005];
int besthub(int R, int L, int X[], long long B)
{
for (int i=1; i <= R; i++) all[i] = X[i-1];
std::sort(all+1,all+R+1);
LL left = 1, right = 1, mx = -1, totalSum = 0;
LL median = 1, newmedian;
LL cost = 0;
LL mxInterval = -1;
while (right <= R){
totalSum += all[right];
int range = (right-left+1);
newmedian = (left+right)>>1;
cost += all[right]-all[median];
if (newmedian > median){
while (median < newmedian){
int change = median - left + 1 - (right - median);
cost += 1LL * change * (all[median+1]-all[median]);
median++;
}
}
while (cost > B){
left++;
cost -= all[median] - all[left-1];
while (median < ((left+right)>>1)){
int change = median - left + 1 - (right - median);
cost += 1LL * change * (all[median+1]-all[median]);
median++;
}
}
mxInterval = std::max(mxInterval, right - left + 1);
right++;
}
return mxInterval;
//return R;
}
컴파일 시 표준 에러 (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... | ||||
