#include <vector>
using namespace std;
double solve(int N, int M, int K, int H, vector<int> x, vector<int>y, vector<int> c, vector<int> arr){
vector<vector<double>> adj(3,vector<double>(3,1e18));
for (int i = 0;i<M;i++){
adj[x[i]][y[i]]=c[i];
adj[y[i]][x[i]]=c[i];
if (arr[x[i]]==0){adj[y[i]][x[i]]=0;}
if (arr[x[i]]==2){adj[y[i]][x[i]]/=2;}
if (arr[y[i]]==0){adj[x[i]][y[i]]=0;}
if (arr[y[i]]==2){adj[x[i]][y[i]]/=2;}
}
int mid=1;
if (H==1){mid=2;}
double ans = min(adj[0][H],adj[0][mid]+adj[mid][H]);
if (ans>=1e18){return -1;}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |