Submission #18689

#TimeUsernameProblemLanguageResultExecution timeMemory
18689suhgyuho_williamRail (IOI14_rail)C++98
30 / 100
120 ms20940 KiB
#include "rail.h" int small,x,v,z,tmp; int dis[5010][5010]; int where[5010],type[5010]; void findLocation(int N, int first, int location[], int stype[]) { int i,j; for(i=0; i<N; i++) location[i] = 999999999; location[0] = first; stype[0] = 1; small = 999999999; for(i=1; i<N; i++){ dis[0][i] = getDistance(0,i); if(small > dis[0][i]){ small = dis[0][i]; v = i; } } location[v] = first+small; stype[v] = 2; where[0] = first; type[0] = 1; where[v] = location[v]; type[v] = 2; for(i=1; i<N; i++){ if(i == v) continue; x = i; dis[x][v] = getDistance(x,v); dis[v][x] = getDistance(v,x); z = dis[0][x]-small; if(z > 0 && dis[v][x] == dis[x][v] && dis[v][x] == (2*small)+z){ stype[x] = 2; location[x] = first+small+z; continue; } tmp = dis[0][x]-small; if(tmp >= 3 && dis[v][x] == (2*small)+tmp && dis[x][v] == dis[v][x]){ stype[x] = 1; continue; } z = dis[v][x]-small; if(z > 0 && dis[x][v] == dis[v][x] && dis[0][x] == (2*small)+z){ stype[x] = 1; location[x] = first-z; continue; } } }

Compilation message (stderr)

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:9:8: warning: unused variable 'j' [-Wunused-variable]
  int i,j;
        ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...