Submission #289658

#TimeUsernameProblemLanguageResultExecution timeMemory
289658Pichon5Rail (IOI14_rail)C++17
30 / 100
85 ms504 KiB
#include "rail.h" #include <bits/stdc++.h> #define pb push_back using namespace std; void findLocation(int N, int first, int location[], int stype[]){ stype[0]=1; location[0]=first; int aux=1000000000,ind; for(int i=1;i<N;i++){ int x=getDistance(i,0); if(x<aux){ aux=x; ind=i; } } if(N==1)return; stype[ind]=2; location[ind]=first+aux; for(int i=1;i<N;i++){ if(i==ind){ continue; } int x=getDistance(0,i); int y=getDistance(ind,i); if(x<y){ stype[i]=2; location[i]=first+x; }else{ stype[i]=1; location[i]=first+aux-y; } } }

Compilation message (stderr)

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:17:11: warning: 'ind' may be used uninitialized in this function [-Wmaybe-uninitialized]
   17 |     stype[ind]=2;
      |           ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...