제출 #286333

#제출 시각아이디문제언어결과실행 시간메모리
286333evpipis도시들 (IOI15_towns)C++11
25 / 100
24 ms896 KiB
#include "towns.h" #include <bits/stdc++.h> using namespace std; #define mp make_pair typedef pair<int, int> ii; const int len = 115; map<ii, int> mym; int disa[len], disb[len]; int ask(int a, int b){ if (a > b) swap(a, b); if (mym.count(mp(a, b))) return mym[mp(a, b)]; return mym[mp(a, b)] = getDistance(a, b); } int hubDistance(int n, int sub) { mym.clear(); int a = 0, b = 0; for (int i = 0; i < n; i++) if (ask(a, i) > ask(a, b)) b = i; for (int i = 0; i < n; i++) if (ask(i, b) > ask(a, b)) a = i; int R = ask(a, b); for (int c = 0; c < n; c++){ disa[c] = (ask(a, b)+ask(a, c)-ask(b, c))/2; disb[c] = ask(a, b)-disa[c]; R = min(R, max(disa[c], disb[c])); } return R; }

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

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:20:28: warning: unused parameter 'sub' [-Wunused-parameter]
   20 | 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...