#include <bits/stdc++.h>
using namespace std;
map<int,set<int>> adj;
int SUBTASK1=0;
bool isCyc=0;
bool isCycle(){
for(auto x:adj){
if(x.second.size()<=1)return false;
}
return true;
}
void init(int N, int M,std::vector<int> U, std::vector<int> V, std::vector<int> W) {
for(int i=0;i<M;i++){
int x=U[i];
int y=V[i];
int z=W[i];
SUBTASK1=max(SUBTASK1,(W[i]));
adj[x].insert(y);
adj[y].insert(x);
}
isCyc=isCycle();
}
// void dfs(int src,int dest,mii &visit,int &res1,bool &found){
// visit[src]=1;
// if(src==dest){
// found=1;
// return ;
// }
// if(found)return ;
// for(int x:adj[src]){
// if(!visit[x]){
// res1=max(res1,edwt[{src,x}]);
// wts.erase(wts.find(edwt[{src,x}]));
// dfs(x,dest,visit,res1,found);
// if(found)return ;
// }
// }
// }
int getMinimumFuelCapacity(int X, int Y) {
if(isCyc){
return SUBTASK1;
}else
return -1;
}
Compilation message
swap.cpp: In function 'void init(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
swap.cpp:16:7: warning: unused variable 'z' [-Wunused-variable]
16 | int z=W[i];
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
0 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
492 KB |
Output is correct |
6 |
Correct |
1 ms |
492 KB |
Output is correct |
7 |
Correct |
2 ms |
492 KB |
Output is correct |
8 |
Correct |
1 ms |
492 KB |
Output is correct |
9 |
Correct |
152 ms |
16876 KB |
Output is correct |
10 |
Correct |
194 ms |
20588 KB |
Output is correct |
11 |
Correct |
187 ms |
20332 KB |
Output is correct |
12 |
Correct |
237 ms |
21612 KB |
Output is correct |
13 |
Correct |
207 ms |
21484 KB |
Output is correct |
14 |
Correct |
163 ms |
17132 KB |
Output is correct |
15 |
Correct |
291 ms |
22644 KB |
Output is correct |
16 |
Correct |
252 ms |
22044 KB |
Output is correct |
17 |
Correct |
281 ms |
23320 KB |
Output is correct |
18 |
Correct |
262 ms |
23420 KB |
Output is correct |
19 |
Correct |
72 ms |
7148 KB |
Output is correct |
20 |
Correct |
290 ms |
28008 KB |
Output is correct |
21 |
Correct |
289 ms |
27556 KB |
Output is correct |
22 |
Correct |
307 ms |
29268 KB |
Output is correct |
23 |
Correct |
340 ms |
29012 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Incorrect |
239 ms |
26348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
364 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
364 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
0 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
492 KB |
Output is correct |
6 |
Correct |
1 ms |
492 KB |
Output is correct |
7 |
Correct |
2 ms |
492 KB |
Output is correct |
8 |
Correct |
1 ms |
492 KB |
Output is correct |
9 |
Correct |
152 ms |
16876 KB |
Output is correct |
10 |
Correct |
194 ms |
20588 KB |
Output is correct |
11 |
Correct |
187 ms |
20332 KB |
Output is correct |
12 |
Correct |
237 ms |
21612 KB |
Output is correct |
13 |
Correct |
207 ms |
21484 KB |
Output is correct |
14 |
Correct |
163 ms |
17132 KB |
Output is correct |
15 |
Correct |
291 ms |
22644 KB |
Output is correct |
16 |
Correct |
252 ms |
22044 KB |
Output is correct |
17 |
Correct |
281 ms |
23320 KB |
Output is correct |
18 |
Correct |
262 ms |
23420 KB |
Output is correct |
19 |
Incorrect |
239 ms |
26348 KB |
Output isn't correct |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
364 KB |
Output isn't correct |