Submission #348465

#TimeUsernameProblemLanguageResultExecution timeMemory
348465tengiz05Rail (IOI14_rail)C++17
30 / 100
447 ms98440 KiB
#include "rail.h" #ifndef EVAL #include "grader.cpp" #endif #include <bits/stdc++.h> using namespace std; const int MAXN = 5005; int dist[MAXN][MAXN], n; void findLocation(int N, int first, int location[], int stype[]){ n = N; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ dist[i][j] = getDistance(i,j); } } stype[0]=1; location[0]=first; if(n == 1)return; int cherez, mn = 1e9; for(int i=1;i<n;i++){ if(mn > dist[0][i]){ mn = dist[0][i]; cherez = i; } } //~ for(int i=0;i<n;i++){ //~ for(int j=0;j<n;j++){ //~ cout << dist[i][j] << ' '; //~ }cout << '\n'; //~ } for(int i=1;i<n;i++)stype[i]=2,location[i]=dist[0][i]+first; for(int i=1;i<n;i++) if(dist[0][i] == dist[0][cherez] + dist[cherez][i] && i!=cherez) stype[i]=1,location[i]=location[cherez]-dist[cherez][i]; //~ for(int i=0;i<n;i++){ //~ cout << stype[i] << ' ' << location[i] << '\n'; //~ } return; }

Compilation message (stderr)

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:33:54: warning: 'cherez' may be used uninitialized in this function [-Wmaybe-uninitialized]
   33 |   if(dist[0][i] == dist[0][cherez] + dist[cherez][i] && i!=cherez)
      |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...