제출 #432772

#제출 시각아이디문제언어결과실행 시간메모리
432772daniel920712도시들 (IOI15_towns)C++14
0 / 100
18 ms420 KiB
#include "towns.h" #include <stdio.h> #include <map> #include <set> using namespace std; int all[205][205]={0}; map < int , int > tt; int hubDistance(int N, int sub) { int i,j,k,ans=2e9,a,b,c,x,y,z,now=0,aa,bb; for(i=0;i<N;i++) { for(j=i+1;j<N;j++) { all[i][j]=all[j][i]=getDistance(i,j); if(all[i][j]>now) { now=all[i][j]; aa=i; bb=j; } } } i=aa; j=bb; for(k=0;k<N;k++) { if(i==k) continue; if(j==k) continue; a=all[i][j]; b=all[i][k]; c=all[j][k]; z=(a+b+c)/2-a; y=(a+b+c)/2-b; x=(a+b+c)/2-c; tt[x]=max(tt[x],max(max(x,y),z)); } for(auto k:tt) { ans=min(ans,a-k.first); } return ans; }

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

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:39:14: warning: declaration of 'k' shadows a previous local [-Wshadow]
   39 |     for(auto k:tt)
      |              ^
towns.cpp:10:13: note: shadowed declaration is here
   10 |     int i,j,k,ans=2e9,a,b,c,x,y,z,now=0,aa,bb;
      |             ^
towns.cpp:8:28: warning: unused parameter 'sub' [-Wunused-parameter]
    8 | int hubDistance(int N, int sub)
      |                        ~~~~^~~
towns.cpp:42:22: warning: 'a' may be used uninitialized in this function [-Wmaybe-uninitialized]
   42 |         ans=min(ans,a-k.first);
      |                     ~^~~~~~~~
towns.cpp:30:10: warning: 'bb' may be used uninitialized in this function [-Wmaybe-uninitialized]
   30 |         a=all[i][j];
      |         ~^~~~~~~~~~
towns.cpp:30:10: warning: 'aa' may be used uninitialized in this function [-Wmaybe-uninitialized]
#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...