#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(false) ;
return -1 ;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
66 ms |
20472 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
66 ms |
20472 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
66 ms |
20472 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
27 ms |
10620 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
66 ms |
20472 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
66 ms |
20472 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |