#include <vector>
#include <algorithm>
#include <map>
using namespace std;
long long const MAXN=2000;
long long dp[1000][1000];
int travel_plan(int n, int M, int R[][2], int L[], int K, int P[])
{
for (int i=0;i<n;i++)
for (int j=0;j<n;j++)
{
dp[i][j]=1e18+10;
if (i==j)
dp[i][j]=0;
}
for (int i=0;i<M;i++)
{
dp[R[i][0]][R[i][1]]=L[i];
dp[R[i][1]][R[i][0]]=L[i];
}
for (int i=0;i<n;i++)
for (int j=0;j<n;j++)
for (int k=0;k<n;k++)
dp[j][k]=min(dp[j][k],dp[j][i]+dp[i][k]);
vector<int>z;
for (int i=0;i<K;i++)
{
z.push_back(dp[0][P[i]]);
}
sort(begin(z),end(z));
return z.back();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
4444 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
4444 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
4444 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |