#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){
int cnt=0;
for(int i=0;i<M;i++){
if(U[i]==0){
cnt++;
}
e[U[i]].push_back(V[i]);
e[V[i]].push_back(U[i]);
mx=max(mx,W[i]);
}
if(cnt==M){
ans=-1;
}
dfs(0,-1);
}
int getMinimumFuelCapacity(int X, int Y) {
if(ans==-1){
return -1;
}
else{
return mx;
}
}
# |
Verdict |
Execution time |
Memory |
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 |
2644 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 |
38 ms |
9452 KB |
Output is correct |
10 |
Correct |
52 ms |
9172 KB |
Output is correct |
11 |
Correct |
43 ms |
9404 KB |
Output is correct |
12 |
Correct |
49 ms |
9592 KB |
Output is correct |
13 |
Correct |
45 ms |
8564 KB |
Output is correct |
14 |
Correct |
43 ms |
9100 KB |
Output is correct |
15 |
Correct |
97 ms |
11236 KB |
Output is correct |
16 |
Correct |
101 ms |
12268 KB |
Output is correct |
17 |
Correct |
105 ms |
14900 KB |
Output is correct |
18 |
Correct |
109 ms |
14048 KB |
Output is correct |
19 |
Correct |
53 ms |
7696 KB |
Output is correct |
20 |
Correct |
113 ms |
15828 KB |
Output is correct |
21 |
Correct |
103 ms |
15752 KB |
Output is correct |
22 |
Correct |
113 ms |
16376 KB |
Output is correct |
23 |
Correct |
110 ms |
16372 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Incorrect |
85 ms |
9816 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
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 |
2644 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 |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2644 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
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 |
2644 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 |
38 ms |
9452 KB |
Output is correct |
10 |
Correct |
52 ms |
9172 KB |
Output is correct |
11 |
Correct |
43 ms |
9404 KB |
Output is correct |
12 |
Correct |
49 ms |
9592 KB |
Output is correct |
13 |
Correct |
45 ms |
8564 KB |
Output is correct |
14 |
Correct |
43 ms |
9100 KB |
Output is correct |
15 |
Correct |
97 ms |
11236 KB |
Output is correct |
16 |
Correct |
101 ms |
12268 KB |
Output is correct |
17 |
Correct |
105 ms |
14900 KB |
Output is correct |
18 |
Correct |
109 ms |
14048 KB |
Output is correct |
19 |
Incorrect |
85 ms |
9816 KB |
Output isn't correct |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2644 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |