#include "bits/stdc++.h"
using namespace std;
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define wr puts("----------------")
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
const int N = 1e5+5;
vector<pii> adj[N];
// ll d[N];
bool vis[N];
double solve(int n, int m, int k, int h, vector<int> u, vector<int> v, vector<int> w, vector<int> arr){
for(int i = 0; i <= n; ++i)
adj[i].clear();
for(int i = 0; i < m; ++i){
adj[u[i]].pb({v[i], w[i]});
adj[v[i]].pb({u[i], w[i]});
}
memset(vis, false, sizeof vis);
// memset(d, -1, sizeof d);
queue<int> q;
q.push(0);
vis[0] = true;
double answer = 0;
while(!q.empty()){
int x = q.front();
q.pop();
for(auto [i, val] : adj[x])
if(!vis[i]){
vis[i] = 1;
answer += val;
if(arr[i] == 0)
answer = 0;
else if(arr[i] == 2)
answer /= 2;
if(i == h)
return answer;
q.push(i);
}
}
return -1;
}
// int main(){
// double kk = solve(5, 4, 10, 2, {0, 1, 2, 3}, {1, 2, 3, 4}, {6, 5, 7, 8}, {1, 1, 2, 1, 1});
// printf("%f\n", kk);
// return 0;
// }
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
23 ms |
2912 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
2904 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
14 ms |
3008 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
18 ms |
6544 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
16 ms |
3052 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
15 ms |
3096 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
25 ms |
2908 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
17 ms |
3068 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |