제출 #282806

#제출 시각아이디문제언어결과실행 시간메모리
282806Ozy철로 (IOI14_rail)C++17
30 / 100
84 ms512 KiB
#include "rail.h" #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for (int i = (a); i <= (b); i++) void findLocation(int N, int first, int location[], int stype[]) { int prim,pos,dis,MIN,a,b; MIN = -1; rep(i,1,N-1) { dis = getDistance(0,i); if (MIN == -1 || dis < MIN) { MIN = dis; pos = first + dis; prim = i; } } location[0] = first; location[prim] = pos; stype[0] = 1; stype[prim] = 2; rep(i,1,N-1) { if (i != prim) { a = getDistance(0,i); b = getDistance(prim,i); if (a < b) { location[i] = first + a; stype[i] = 2; } else { location[i] = pos - b; stype[i] = 1; } } } }

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

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