#include "dreaming.h"
#include<bits/stdc++.h>
using namespace std;
int d[3][1<<17],f[1<<17],W[1<<17],w,e,D,F,S;
vector<pair<int,int> >v[1<<17];
void dfs(int x,int o){
f[x]++;
if(o<2&&d[o][x]>=D)e=x,D=d[o][x];
if(o>1)D=min(D,max(d[1][x],d[2][x]));
for(auto y:v[x])if(f[y.first]<=o)d[o][y.first]=d[o][x]+y.second,dfs(y.first,o);
}
int travelTime(int N,int M,int L,int A[],int B[],int T[]){
while(M--)v[A[M]].push_back({B[M],T[M]}),v[B[M]].push_back({A[M],T[M]});
while(N--)if(!f[N])dfs(N,0),dfs(e,1),dfs(e,2),W[w++]=-D,D=0;
sort(W,W+w);
return max(-W[0],-W[2]+L)-W[1]+L;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
61 ms |
15980 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
3436 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
61 ms |
15980 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
7532 KB |
Output is correct |
2 |
Correct |
28 ms |
7916 KB |
Output is correct |
3 |
Correct |
28 ms |
7916 KB |
Output is correct |
4 |
Correct |
29 ms |
8044 KB |
Output is correct |
5 |
Correct |
28 ms |
7916 KB |
Output is correct |
6 |
Correct |
33 ms |
8172 KB |
Output is correct |
7 |
Correct |
32 ms |
8044 KB |
Output is correct |
8 |
Correct |
27 ms |
7788 KB |
Output is correct |
9 |
Correct |
32 ms |
7916 KB |
Output is correct |
10 |
Correct |
29 ms |
8044 KB |
Output is correct |
11 |
Correct |
3 ms |
3436 KB |
Output is correct |
12 |
Correct |
7 ms |
5228 KB |
Output is correct |
13 |
Correct |
7 ms |
5356 KB |
Output is correct |
14 |
Correct |
10 ms |
5228 KB |
Output is correct |
15 |
Correct |
7 ms |
5228 KB |
Output is correct |
16 |
Correct |
7 ms |
5100 KB |
Output is correct |
17 |
Correct |
7 ms |
4588 KB |
Output is correct |
18 |
Correct |
8 ms |
5356 KB |
Output is correct |
19 |
Correct |
7 ms |
5228 KB |
Output is correct |
20 |
Incorrect |
3 ms |
3436 KB |
Output isn't correct |
21 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
3436 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
61 ms |
15980 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |