| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 743327 | vjudge1 | Rice Hub (IOI11_ricehub) | C++17 | 2 ms | 340 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int besthub(int R, int L, int X[], long long B)
{
int mid = X[R / 2];
int left = (R / 2) - 1;
int right = (R / 2) + 1;
int possible = 1;
int curcost = 0;
bool breakleft = false;
bool breakright = false;
while (!breakleft || !breakright)
{
int disleft, disright;
if (left >= 0)
disleft = mid - X[left];
else
breakleft = 1;
if (right < R)
disright = X[right] - mid;
else
breakright = 1;
if (disleft > disright && !breakleft)
{
if (disleft + curcost <= B)
{
possible++;
curcost += disleft;
left--;
}
else
{
breakleft = true;
}
if (disright + curcost <= B)
{
possible++;
curcost += disright;
right++;
}
else
{
breakright = true;
}
}
else
{
if (disright + curcost <= B)
{
possible++;
curcost += disright;
right++;
}
else
{
breakright = true;
}
if (disleft + curcost <= B)
{
possible++;
curcost += disleft;
left--;
}
else
{
breakleft = true;
}
}
}
cout << possible;
return possible;
}
/*
5 20 6
1 2 10 12 14
*/
컴파일 시 표준 에러 (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... | ||||
