Submission #282806

#TimeUsernameProblemLanguageResultExecution timeMemory
282806OzyRail (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; } } } }

Compilation message (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...