#include <bits/stdc++.h>
#include "dreaming.h"
using namespace std;
const int MAX = 1e5 + 10 ;
vector< vector< pair<int, int> > >adjlist(MAX) ;
int comp[MAX] ;
int cnt = 0 ;
void dfs(int node , int par)
{
comp[node] = cnt ;
for(auto &child : adjlist[node])
{
if(child.first != par)
dfs(child.first , node) ;
}
return ;
}
int travelTime(int N,int M,int L,int A[],int B[],int T[])
{
cnt = 0 ;
for(int i = 0 ; i < M ; ++i)
{
int x = A[i] , y = B[i] , z = T[i] ;
adjlist[x].push_back({y , z}) ;
adjlist[y].push_back({x , z}) ;
}
for(int i = 1 ; i <= N ; ++i)
{
if(comp[i] == 0)
{
++cnt ;
dfs(i , i) ;
}
}
if(cnt > 2)
assert(true) ;
return -1 ;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
73 ms |
10232 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
73 ms |
10232 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
73 ms |
10232 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
24 ms |
5344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
73 ms |
10232 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
73 ms |
10232 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |