#include <bits/stdc++.h>
#include "cyberland.h"
using namespace std;
#define ff first
#define ss second
double solve(int n, int m, int k, int h, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) {
vector <pair<int,int>> v[n+5];
for(int i = 0; i < m; i++){
v[x[i]].push_back({y[i],c[i]});
v[y[i]].push_back({x[i],c[i]});
}
priority_queue <pair<double,pair<int,int>>> q;
vector <double> dis(n+5,1e9);
vector <int> dis1(n+5,k+1);
dis[0] = 0;
dis1[0] = 0;
q.push({0,{0,0}});
while(!q.empty()){
auto [ind,kcur] = q.top().ss;
double w = q.top().ff;
q.pop();
if(w < 0) w *= (-1);
dis1[ind] = min(dis1[ind],kcur);
dis[ind] = min(dis[ind],w);
if(h == ind) continue;
double w2 = w;
for(auto [i,j] : v[ind]){
w = w2;
if(arr[i] == 0){
w = 0;
if(dis[i] > 0){
q.push({0,{i,kcur}});
}
}
else if(arr[i] == 2){
w += j;
if(kcur < k){
w /= 2;
kcur++;
if(dis[i] > w){
q.push({-w,{i,kcur}});
}
kcur--;
}
w = w2;
if(dis[i] > w){
q.push({-w,{i,kcur}});
}
}
else {
w += j;
if(w < dis[i]){
q.push({-w,{i,kcur}});
}
}
}
}
if(dis[h] == 1e9) return -1;
return dis[h];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
604 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
600 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
18 ms |
348 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
22 ms |
5976 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
13 ms |
604 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
84 ms |
4808 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3106 ms |
1051288 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3050 ms |
1051292 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |