제출 #429071

#제출 시각아이디문제언어결과실행 시간메모리
429071_ani철로 (IOI14_rail)C++17
8 / 100
88 ms488 KiB
#include "rail.h" #include <iostream> #include <algorithm> void findLocation(int N, int first, int location[], int stype[]) { location[0] = first; stype[0] = 1; int mi = 500002, mii; for (int i = 1; i < N; i++) { int dist = getDistance(0, i); if (dist < mi) { mi = dist; mii = i; } } location[mii] = first + mi; stype[mii] = 2; for (int i = 1; i < N; i++) if (i != mii) { int dist = getDistance(i, mii); if (dist == getDistance(i, 0) + mi) { location[i] = first + getDistance(i, 0); stype[i] = 2; } else { location[i] = mii - dist; stype[i] = 1; } } }

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

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:19:14: warning: 'mii' may be used uninitialized in this function [-Wmaybe-uninitialized]
   19 |     location[mii] = first + mi;
      |              ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...