제출 #284413

#제출 시각아이디문제언어결과실행 시간메모리
284413SamAnd도시들 (IOI15_towns)C++17
25 / 100
31 ms1152 KiB
#include "towns.h" #include <bits/stdc++.h> using namespace std; const int N = 115, INF = 1000000009; int n; int ans[N][N]; int qry(int x, int y) { if (ans[x][y] != -1) return ans[x][y]; return ans[x][y] = ans[y][x] = getDistance(x, y); } int hubDistance(int N_, int sub) { n = N_; for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { if (i == j) continue; ans[i][j] = -1; } } int maxu = -1; int maxx; for (int x = 0; x < n; ++x) { if (qry(0, x) > maxu) { maxu = qry(0, x); maxx = x; } } int u1 = maxx; maxu = -1; for (int x = 0; x < n; ++x) { if (qry(u1, x) > maxu) { maxu = qry(u1, x); maxx = x; } } int u2 = maxx; int R = INF; for (int x = 0; x < n; ++x) { int t1 = qry(u1, u2); int t2 = qry(u1, x); int t3 = qry(u2, x); R = min(R, max((t1 + t3 - t2) / 2, max((t1 + t2 - t3) / 2, (t2 + t3 - t1) / 2))); } return R; }

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

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:16:29: warning: unused parameter 'sub' [-Wunused-parameter]
   16 | int hubDistance(int N_, int sub)
      |                         ~~~~^~~
towns.cpp:30:9: warning: 'maxx' may be used uninitialized in this function [-Wmaybe-uninitialized]
   30 |     int maxx;
      |         ^~~~
#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...