제출 #1029652

#제출 시각아이디문제언어결과실행 시간메모리
1029652kunzaZa183도시들 (IOI15_towns)C++17
25 / 100
13 ms1060 KiB
#include "towns.h" #include <bits/stdc++.h> using namespace std; const int maxn = 110; int dist[maxn][maxn]; int hubDistance(int N, int sub) { for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) dist[i][j] = -1; for (int i = 1; i < N; i++) { int x = getDistance(0, i); dist[i][0] = x, dist[0][i] = x; } int r1 = 1, r2; for (int i = 1; i < N; i++) if (dist[0][r1] < dist[0][i]) r1 = i; for (int i = 0; i < N; i++) { int x = getDistance(r1, i); dist[r1][i] = x, dist[i][r1] = x; } r2 = r1; for (int i = 0; i < N; i++) if (dist[r1][r2] < dist[r1][i]) { // cout << dist[r1][r2] << " " << dist[r1][i] << " " << i << "\n"; r2 = i; } for (int i = 0; i < N; i++) { int x = getDistance(i, r2); dist[i][r2] = x, dist[r2][i] = x; } // cerr << r1 << " " << r2 << "\n"; map<int, int> mii; for (int i = 0; i < N; i++) if (i != r1 && i != r2) { int sumall = (dist[i][r1] + dist[r1][r2] + dist[i][r2]) / 2; int tor1 = sumall - dist[i][r2], toi = sumall - dist[r1][r2], tor2 = sumall - dist[i][r1]; mii[tor1] = max({mii[tor1], tor1, tor2, toi}); } int maxi = INT_MAX; for (auto a : mii) maxi = min(maxi, a.second); return maxi; }

컴파일 시 표준 에러 (stderr) 메시지

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:8:28: warning: unused parameter 'sub' [-Wunused-parameter]
    8 | int hubDistance(int N, int sub) {
      |                        ~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...