제출 #429158

#제출 시각아이디문제언어결과실행 시간메모리
429158_ani철로 (IOI14_rail)C++17
8 / 100
95 ms500 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(0, i); stype[i] = 2; } else { location[i] = mii - getDistance(mii, i); 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...