Submission #28810

#TimeUsernameProblemLanguageResultExecution timeMemory
28810NikeforRace (IOI11_race)C++98
0 / 100
3 ms376 KiB
#include "race.h" #define inf 1<<20 int best_path(int N, int K, int H[][2], int L[]) { int dis[N][N][2]; for(int i=0; i<N; i++) for(int j=0; j<N; j++) { dis[i][j][0] = dis[i][j][1] = (i==j)?0:inf; } for(int i=0; i<N; i++) { dis[H[i][0]][H[i][1]][0] = dis[H[i][0]][H[i][1]][0] = L[i]; dis[H[i][0]][H[i][1]][1] = dis[H[i][0]][H[i][1]][1] = 1; } for(int i=0; i<N; i++) for(int j=0; j<N; j++) for(int k=0; k<N; k++) { if(dis[i][k][0] < dis[i][j][0]+dis[i][k][0]) { dis[i][k][0] = dis[k][i][0] = dis[i][j][0]+dis[i][k][0]; dis[i][k][1] = dis[k][i][1] = dis[i][j][1]+dis[i][k][1]; } } int opt = inf; for(int i=0; i<N; i++) for(int j=0; j<N; j++) { if(dis[i][j][0] == K and dis[i][j][1] < opt) opt = dis[i][j][1]; } return opt==inf?-1:opt; }

Compilation message (stderr)

race.cpp: In function 'int best_path(int, int, int (*)[2], int*)':
race.cpp:11:34: warning: operation on 'dis[(*(H + ((sizetype)(((long unsigned int)i) * 8))))[0]][(*(H + ((sizetype)(((long unsigned int)i) * 8))))[1]][0]' may be undefined [-Wsequence-point]
         dis[H[i][0]][H[i][1]][0] = dis[H[i][0]][H[i][1]][0] = L[i];
         ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
race.cpp:12:34: warning: operation on 'dis[(*(H + ((sizetype)(((long unsigned int)i) * 8))))[0]][(*(H + ((sizetype)(((long unsigned int)i) * 8))))[1]][1]' may be undefined [-Wsequence-point]
         dis[H[i][0]][H[i][1]][1] = dis[H[i][0]][H[i][1]][1] = 1;
         ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...