제출 #434004

#제출 시각아이디문제언어결과실행 시간메모리
434004benedict0724도시들 (IOI15_towns)C++17
0 / 100
16 ms328 KiB
#include "towns.h" #include <stack> using namespace std; int S = 0, E; const int INF = 1e9; int dist[110], dist2[110], Hub[110], x[110], y[110]; int getSame(int x, int y) { } int hubDistance(int N, int sub) { for(int i=0;i<N;i++) dist[i] = dist2[i] = Hub[i] = x[i] = y[i] = 0; for(int i=1;i<N;i++) dist[i] = getDistance(S, i); E = 1; for(int i=1;i<N;i++) if(dist[E] < dist[i]) E = i; for(int i=0;i<N;i++) { if(i == E) continue; dist2[i] = getDistance(i, E); } int Rad = dist[E]; int opt = 0; for(int i=1;i<N;i++) { if(i == E) continue; Hub[i] = (dist[i] + dist2[i] - Rad)/2; x[i] = (dist[i] + Rad - dist2[i])/2; y[i] = (-dist[i] + Rad + dist2[i])/2; int now = max(x[i], max(y[i], Hub[i])); if(now > opt) { Hub[S] = x[i]; Hub[E] = y[i]; opt = now; } } for(int i=1;i<N;i++) { if(i == E) continue; Hub[i] += x[i] - Hub[S]; } int R = max(Hub[S], Hub[E]); /* stack<int> st; st.push(0); for(int i=0;i<N;i++) { } */ return R; }

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

towns.cpp: In function 'int getSame(int, int)':
towns.cpp:10:24: warning: declaration of 'y' shadows a global declaration [-Wshadow]
   10 | int getSame(int x, int y)
      |                    ~~~~^
towns.cpp:8:46: note: shadowed declaration is here
    8 | int dist[110], dist2[110], Hub[110], x[110], y[110];
      |                                              ^
towns.cpp:10:17: warning: declaration of 'x' shadows a global declaration [-Wshadow]
   10 | int getSame(int x, int y)
      |             ~~~~^
towns.cpp:8:38: note: shadowed declaration is here
    8 | int dist[110], dist2[110], Hub[110], x[110], y[110];
      |                                      ^
towns.cpp:13:1: warning: no return statement in function returning non-void [-Wreturn-type]
   13 | }
      | ^
towns.cpp:10:17: warning: unused parameter 'x' [-Wunused-parameter]
   10 | int getSame(int x, int y)
      |             ~~~~^
towns.cpp:10:24: warning: unused parameter 'y' [-Wunused-parameter]
   10 | int getSame(int x, int y)
      |                    ~~~~^
towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:15:28: warning: unused parameter 'sub' [-Wunused-parameter]
   15 | 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...