# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
394745 | suren | Swapping Cities (APIO20_swap) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mk make_pair
int n, m, flag = true;
int ans = 0;
vector < int > u, v, w;
vector < int > vc[200045];
map < pair < int , int >, int > mp;
void init(int N, int M,
std::vector<int> U, std::vector<int> V, std::vector<int> W) {
int i;
n = N;
m = M;
u = U;
v = V;
w = W;
for( i = 0; i < m; i ++ ){
vc[ u[i] ].pb( v[i] );
vc[ v[i] ].pb( u[i] );
mp[ mk( u[i], v[i] ) ] = w[i];
mp[ mk( v[i], u[i] ) ] = w[i];
}
for( i = 0; i < n; i ++ ){
if( vc[i].size() != 2 ){
flag = false;
break;
}
}
for( i = 0; i < m; i ++ ){
ans = max( ans, w[i] );
}
return ans;
}
bool vis[200045];
int getMinimumFuelCapacity(int X, int Y) {
int i;
if( flag == true ){
return ans;
}
return -1;
}