제출 #159293

#제출 시각아이디문제언어결과실행 시간메모리
159293TAISA_철로 (IOI14_rail)C++14
30 / 100
83 ms500 KiB
#include "rail.h" #include <bits/stdc++.h> using namespace std; void findLocation(int N, int first, int location[], int stype[]) { location[0] = first; stype[0] = 1; int mi = 10000000, id; for (int i = 1; i < N; i++) { int d = getDistance(0, i); if (mi > d) { mi = d; id = i; } } location[id] = first + mi; stype[id] = 2; for (int i = 1; i < N; i++) { if (i == id) { continue; } int d1 = getDistance(0, i); int d2 = getDistance(id, i); if (d1 == d2 + mi) { location[i] = location[id] - d2; stype[i] = 1; } else { location[i] = location[0] + d1; stype[i] = 2; } } }

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

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:15:16: warning: 'id' may be used uninitialized in this function [-Wmaybe-uninitialized]
     location[id] = 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...