제출 #691195

#제출 시각아이디문제언어결과실행 시간메모리
691195boyliguanhan경주 (Race) (IOI11_race)C++17
9 / 100
39 ms29508 KiB
#include "race.h" #include <bits/stdc++.h> using namespace std; vector<pair<int, int>> adj[200000]; int dis[1000][1000][2]; int best_path(int N, int K, int H[][2], int L[]) { memset(dis, 1, sizeof dis); for(int i = 0; i < N-1; i++) dis[H[i][0]][H[i][1]][0] = 1, dis[H[i][1]][H[i][0]][0] = 1, dis[H[i][0]][H[i][1]][1] = L[i], dis[H[i][1]][H[i][0]][0] = L[i]; for(int x = 0; x < 2; x++) for(int i = 0; i < N; i++) for(int j = 0; j < N; j++) for(int k = 0; k < N; k++) dis[j][k][x] = min(dis[j][k][x], dis[j][i][x]+dis[i][k][x]); int ans = 100000; for(int i = 0; i < N; i++) for(int j = 0; j < N; j++) if(dis[i][j][1]==K) ans = min(ans, dis[i][j][0]); return ans>N?-1:ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...