# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
498979 | 2021-12-26T21:22:30 Z | aymanrs | Swapping Cities (APIO20_swap) | C++14 | 0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; int ans = 0; void init(int N, int M, int U[], int V[], int W[]){ int deg[N] = {0}; for(int i = 0;i < M;i++) { deg[U[i]]++; deg[V[i]]++; ans = max(ans, W[i]); } for(int i = 0;i < N;i++){ if(deg[i] == 1) ans = -1; } } int getMinimumFuelCapacity(int x, int y){ return ans; } // int main(){ // init(3, 3, {1, 2, 3}, {2, 3, 1}, {4, 5, 2}); // cout << getMinimumFuelCapacity(1, 3) << '\n'; // }