#include<bits/stdc++.h>
#include"dreaming.h"
using namespace std;
const int MAX = 2e6 + 15;
const int INF = 0x3f3f3f3f;
#define fr first
#define sc second
bool seen[MAX];
vector<pair<int, int>> adj[MAX];
void dfs(int u){
seen[u] = true;
for(auto e : adj[u]){
int v = e.fr;
if(!seen[v]) dfs(v);
}
}
int travelTime(int n, int m, int L, int A[], int B[], int T[]){
int ret = 0, comp = 0;
for(int i = 0; i < m; i++){
int u = A[i], v = B[i], w = T[i];
adj[u].push_back({v, w});
adj[v].push_back({u, w});
ret += w;
}
for(int i = 0; i < n; i++){
if(seen[i]) continue;
seen[i] = true;
comp++;
dfs(i);
}
return (comp - 1) * L + ret;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
58 ms |
52300 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
23 ms |
47188 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
58 ms |
52300 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
41 ms |
49820 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
23 ms |
47188 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
58 ms |
52300 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |