#include <bits/stdc++.h>
#include "cyberland.h"
// #include "stub.cpp"
using namespace std;
#define ll long long
#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> a) {
vector <pair<ll,ll>> 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<ll,ll>> q;
q.push({0,0});
vector <ll> dis(n+1,1e18);
dis[0] = 0;
while(!q.empty()){
auto [w,x] = q.top();
q.pop();
if(-w != dis[x]) continue;
if(x == h) continue;
for(auto [to,w1] : v[x]){
if((dis[to] > dis[x] + w1) or (a[to] == 0 and dis[to] != 0)){
dis[to] = dis[x] + w1;
if(a[to] == 0) dis[to] = 0;
q.push({-dis[to],to});
}
}
}
if(dis[h] == 1e18) return -1;
return dis[h];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
11 ms |
604 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
604 KB |
Correct. |
2 |
Correct |
20 ms |
1444 KB |
Correct. |
3 |
Correct |
30 ms |
1564 KB |
Correct. |
4 |
Correct |
20 ms |
1628 KB |
Correct. |
5 |
Correct |
19 ms |
1628 KB |
Correct. |
6 |
Correct |
16 ms |
2392 KB |
Correct. |
7 |
Correct |
22 ms |
2628 KB |
Correct. |
8 |
Correct |
9 ms |
3164 KB |
Correct. |
9 |
Correct |
17 ms |
1372 KB |
Correct. |
10 |
Correct |
16 ms |
1368 KB |
Correct. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
20 ms |
604 KB |
Correct. |
2 |
Correct |
20 ms |
1472 KB |
Correct. |
3 |
Correct |
20 ms |
1540 KB |
Correct. |
4 |
Correct |
22 ms |
1372 KB |
Correct. |
5 |
Correct |
17 ms |
1372 KB |
Correct. |
6 |
Correct |
5 ms |
1372 KB |
Correct. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
21 ms |
6748 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
600 KB |
Correct. |
2 |
Correct |
19 ms |
1596 KB |
Correct. |
3 |
Correct |
19 ms |
1640 KB |
Correct. |
4 |
Correct |
17 ms |
2396 KB |
Correct. |
5 |
Correct |
16 ms |
1116 KB |
Correct. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
20 ms |
604 KB |
Correct. |
2 |
Correct |
22 ms |
1372 KB |
Correct. |
3 |
Correct |
32 ms |
11092 KB |
Correct. |
4 |
Correct |
12 ms |
1880 KB |
Correct. |
5 |
Correct |
18 ms |
1372 KB |
Correct. |
6 |
Correct |
18 ms |
1516 KB |
Correct. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
20 ms |
604 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
19 ms |
604 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |