제출 #748248

#제출 시각아이디문제언어결과실행 시간메모리
748248Abrar_Al_Samit도시들 (IOI15_towns)C++17
25 / 100
16 ms1104 KiB
#include <bits/stdc++.h> #include "towns.h" using namespace std; const int nax = 110; int from0[nax]; int from_en[2][nax]; int en1, en2; int hubDistance(int N, int sub) { int mx = 0; for(int i=1; i<N; ++i) { from0[i] = getDistance(0, i); if(mx<from0[i]) { mx = from0[i]; en1 = i; } } mx = 0; for(int i=0; i<N; ++i) { from_en[0][i] = getDistance(i, en1); if(from_en[0][i]>mx) { mx = from_en[0][i]; en2 = i; } } for(int i=0; i<N; ++i) { from_en[1][i] = getDistance(i, en2); } int R = 2e9; map<int, int>groups; for(int i=0; i<N; ++i) { int a_plus_b = from_en[0][en2]; int a_plus_c = from_en[0][i]; int b_plus_c = from_en[1][i]; int b = (b_plus_c - a_plus_c + a_plus_b) / 2; int c = b_plus_c - b; int a = a_plus_b - b; R = min(R, max(a, b)); groups[b]++; } for(auto it : groups) if(it.second>N/2) { R = -R; break; } return R; }

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

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:41:7: warning: unused variable 'c' [-Wunused-variable]
   41 |   int c = b_plus_c - b;
      |       ^
towns.cpp:11:28: warning: unused parameter 'sub' [-Wunused-parameter]
   11 | 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...