Submission #159293

#TimeUsernameProblemLanguageResultExecution timeMemory
159293TAISA_Rail (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; } } }

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