제출 #1088386

#제출 시각아이디문제언어결과실행 시간메모리
1088386Pacybwoah도시들 (IOI15_towns)C++17
25 / 100
11 ms960 KiB
#include "towns.h" #include<vector> #include<algorithm> #include<utility> using namespace std; int hubDistance(int N, int sub) { int a = -1, b = -1; int maxi = 0, n = N; for(int i = 1; i < n; i++){ int len = getDistance(0, i); if(len > maxi){ maxi = len; a = i; } } vector<int> dista(n), distb(n); maxi = 0; for(int i = 0; i < n; i++){ dista[i] = getDistance(a, i); if(dista[i] > maxi){ maxi = dista[i]; b = i; } } for(int i = 0; i < n; i++){ distb[i] = getDistance(b, i); } int d = dista[b]; int ans = 1e9; for(int i = 0; i < n; i++){ int da = (d + dista[i] + distb[i]) / 2 - distb[i], db = (d + dista[i] + distb[i]) / 2 - dista[i]; ans = min(ans, max(da, db)); } return ans; } // g++ -std=c++17 -Wall -Wextra -fsanitize=undefined -fsanitize=address -Wshadow -o run towns.cpp grader.cpp

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

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