#include "crocodile.h"
#include<bits/stdc++.h>
using namespace std;
int dist[1007][1007];
bool exitc[1007];
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
for(int i=0;i<K;++i) exitc[P[i]]=true;
memset(dist,0x3f,sizeof(dist));
for(int i=0;i<M;++i) dist[R[i][0]][R[i][1]]=dist[R[i][1]][R[i][0]]=L[i];
for(int i=0;i<N;++i) dist[i][i]=0;
for(int k=0;k<N;++k){
for(int i=0;i<N;++i){
for(int j=0;j<N;++j){
dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
}
}
}
int mn=1e9;
for(int i=0;i<N;++i){
if(exitc[i]) mn=min(mn,dist[0][i]);
}
return mn;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
6736 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
6736 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
6736 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |