# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
66137 | Eae02 | Shortcut (IOI16_shortcut) | C++14 | 3 ms | 484 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "shortcut.h"
#include <bits/stdc++.h>
using ll = long long;
std::vector<ll> distBefore;
ll mainLineDist(int a, int b)
{
if (a > b)
std::swap(a, b);
if (a == b)
return 0;
return distBefore[b - 1] - ((a == 0) ? 0 : distBefore[a - 1]);
}
long long find_shortcut(int n, std::vector<int> l, std::vector<int> d, int c)
{
distBefore.resize(n - 1);
ll distAcc = 0;
for (int i = 0; i < l.size(); i++)
{
distAcc += l[i];
distBefore[i] = distAcc;
}
ll ans = INT64_MAX;
for (ll a = 0; a < n; a++)
{
for (ll b = a + 2; b < n; b++)
{
ll md = 0;
for (ll u = 0; u < n; u++)
{
for (ll v = u + 1; v < n; v++)
{
ll e = d[u] + d[v];
ll minThis = INT64_MAX;
minThis = std::min(minThis, mainLineDist(u, v) + e);
minThis = std::min(minThis, mainLineDist(u, a) + mainLineDist(v, b) + e + c);
minThis = std::min(minThis, mainLineDist(u, b) + mainLineDist(v, a) + e + c);
md = std::max(md, minThis);
}
}
ans = std::min(ans, md);
}
}
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... |
# | 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... |