#include "swap.h"
#include <bits/stdc++.h>
using namespace std;
#ifndef EVAL
#include "grader.cpp"
#endif
vector<int> e[100005];
int used[100005],mx=0;
int ans=0;
void dfs(int x,int p){
if(e[x].size()==1){
ans=-1;
return;
}
if(ans==-1){
return;
}
used[x]++;
for(auto w : e[x]){
if(used[w]==0){
dfs(w,x);
}
}
}
void init(int N, int M, vector<int> U, vector<int> V, vector<int> W){
for(int i=0;i<M;i++){
e[U[i]].push_back(V[i]);
e[V[i]].push_back(U[i]);
mx=max(mx,W[i]);
}
dfs(0,-1);
}
int getMinimumFuelCapacity(int X, int Y) {
if(ans==-1){
return -1;
}
else{
return mx;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
1 ms |
2644 KB |
Output is correct |
4 |
Correct |
2 ms |
2672 KB |
Output is correct |
5 |
Correct |
2 ms |
2644 KB |
Output is correct |
6 |
Correct |
2 ms |
2644 KB |
Output is correct |
7 |
Correct |
2 ms |
2644 KB |
Output is correct |
8 |
Correct |
2 ms |
2644 KB |
Output is correct |
9 |
Correct |
45 ms |
9464 KB |
Output is correct |
10 |
Correct |
73 ms |
9160 KB |
Output is correct |
11 |
Correct |
54 ms |
9408 KB |
Output is correct |
12 |
Correct |
46 ms |
9580 KB |
Output is correct |
13 |
Correct |
52 ms |
8692 KB |
Output is correct |
14 |
Correct |
49 ms |
9088 KB |
Output is correct |
15 |
Correct |
107 ms |
11248 KB |
Output is correct |
16 |
Correct |
95 ms |
12280 KB |
Output is correct |
17 |
Correct |
111 ms |
14820 KB |
Output is correct |
18 |
Correct |
144 ms |
14072 KB |
Output is correct |
19 |
Correct |
64 ms |
7756 KB |
Output is correct |
20 |
Correct |
110 ms |
20036 KB |
Output is correct |
21 |
Correct |
107 ms |
19912 KB |
Output is correct |
22 |
Correct |
134 ms |
20836 KB |
Output is correct |
23 |
Correct |
107 ms |
20768 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Incorrect |
82 ms |
9836 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
1 ms |
2644 KB |
Output is correct |
4 |
Correct |
2 ms |
2672 KB |
Output is correct |
5 |
Correct |
2 ms |
2644 KB |
Output is correct |
6 |
Correct |
2 ms |
2644 KB |
Output is correct |
7 |
Correct |
2 ms |
2644 KB |
Output is correct |
8 |
Correct |
2 ms |
2644 KB |
Output is correct |
9 |
Incorrect |
2 ms |
2644 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
2644 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
1 ms |
2644 KB |
Output is correct |
4 |
Correct |
2 ms |
2672 KB |
Output is correct |
5 |
Correct |
2 ms |
2644 KB |
Output is correct |
6 |
Correct |
2 ms |
2644 KB |
Output is correct |
7 |
Correct |
2 ms |
2644 KB |
Output is correct |
8 |
Correct |
2 ms |
2644 KB |
Output is correct |
9 |
Correct |
45 ms |
9464 KB |
Output is correct |
10 |
Correct |
73 ms |
9160 KB |
Output is correct |
11 |
Correct |
54 ms |
9408 KB |
Output is correct |
12 |
Correct |
46 ms |
9580 KB |
Output is correct |
13 |
Correct |
52 ms |
8692 KB |
Output is correct |
14 |
Correct |
49 ms |
9088 KB |
Output is correct |
15 |
Correct |
107 ms |
11248 KB |
Output is correct |
16 |
Correct |
95 ms |
12280 KB |
Output is correct |
17 |
Correct |
111 ms |
14820 KB |
Output is correct |
18 |
Correct |
144 ms |
14072 KB |
Output is correct |
19 |
Incorrect |
82 ms |
9836 KB |
Output isn't correct |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
2644 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |