# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1041761 | KasymK | Swapping Cities (APIO20_swap) | C++17 | 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 ff first
#define ss second
#define all(v) v.begin(), v.end()
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define wr puts("----------------")
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
const int MOD = 1e9+7;
const int INF = 1e9;
const int N = 2e5+5;
vector<pii> adj[N];
int mn = INF, mx = 0;
int deg[N];
void init(int n, int m, vector<int> u, vector<int> v, vector<int> w){
for(int i = 0; i < m; ++i){
adj[u[i]].pb({v[i], w[i]});
adj[v[i]].pb({u[i], w[i]});
umax(mx, w[i]);
deg[u[i]]++, deg[v[i]]++;
}
for(int i = 0; i < n; ++i)
umin(mn, deg[i]);
}
getMinimumFuelCapacity(int x, int y){
if(mn == 1)
return -1;
else
return mx; // you need to traverse all edges on cycle
}