제출 #798495

#제출 시각아이디문제언어결과실행 시간메모리
798495Username4132도시들 (IOI15_towns)C++14
25 / 100
12 ms884 KiB
#include "towns.h" #include<iostream> using namespace std; #define forn(i, n) for(int i=0; i<(int)n; ++i) #define forsn(i, s, n) for(int i=s; i<(int)n; ++i) const int MAXN = 120; int n, d1[MAXN], d2[MAXN]; int hubDistance(int N, int sub) { n=N; forn(i, n) d1[i]=d2[i]=0; int mx = -1, u, v; forsn(i, 1, n){ int dis = getDistance(0, i); if(dis>mx) mx=dis, u=i; } mx=-1; forn(i, n) if(i!=u){ d1[i]=getDistance(u, i); if(d1[i]>mx) mx=d1[i], v=i; } int mn=1000000000; forn(i, n) if(i!=v){ d2[i]=getDistance(v, i); mn=min(mn, abs(d1[i]-d2[i])); } return (d1[v]+mn)>>1; }

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

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:10:28: warning: unused parameter 'sub' [-Wunused-parameter]
   10 | int hubDistance(int N, int sub) {
      |                        ~~~~^~~
towns.cpp:28:14: warning: 'v' may be used uninitialized in this function [-Wmaybe-uninitialized]
   28 |  return (d1[v]+mn)>>1;
      |          ~~~~^
towns.cpp:20:20: warning: 'u' may be used uninitialized in this function [-Wmaybe-uninitialized]
   20 |   d1[i]=getDistance(u, i);
      |         ~~~~~~~~~~~^~~~~~
#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...