# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
368415 | KoD | Towns (IOI15_towns) | C++17 | 24 ms | 1152 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "towns.h"
#include <vector>
#include <algorithm>
#include <utility>
#include <iostream>
#define whole(c) std::begin(c), std::end(c)
template <class T>
using Vec = std::vector<T>;
int hubDistance(int N, int sub) {
Vec<int> from0(N);
for (int i = 0; i < N; ++i) {
from0[i] = getDistance(0, i);
}
const auto X = std::max_element(whole(from0)) - std::begin(from0);
Vec<int> fromX(N);
for (int i = 0; i < N; ++i) {
fromX[i] = getDistance(X, i);
}
const auto Y = std::max_element(whole(fromX)) - std::begin(fromX);
int ret = 1000005;
for (int i = 0; i < N; ++i) {
const auto x = fromX[i];
const auto y = getDistance(Y, i);
const auto z = ((x + y) - fromX[Y]) / 2;
ret = std::min(ret, std::max(x - z, y - z));
}
return ret;
}
#ifdef LOCAL
int dist[100][100];
int getDistance(int i, int j) {
return dist[i][j];
}
int main() {
int sub, tests;
std::cin >> sub >> tests;
while (tests--) {
int N;
std::cin >> N;
for (int i = 0; i < N; ++i) {
for (int j = 0; j < N; ++j) {
std::cin >> dist[i][j];
}
}
std::cout << hubDistance(N, sub) << '\n';
}
return 0;
}
#endif
컴파일 시 표준 에러 (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... |