# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
405915 | Maqsut_03 | 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 "swap.h"
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<deque>
#define ll long long
#define pl pair<ll, ll>
#define llv vector<ll>
#define pb push_back
#define ppb(x, y) push_back({x, y})
using namespace std;
const int N = 2 * 1e5 + 3;
int n, m, a = 0, b = 0;
pv v[N];
bool q = 1;
void init(int N, int M, vector<int> U, vector<int> V, vector<int> W)
{
n = N;
m = M;
for (int i=0; i<m; i++)
{
v[V[i]].ppb(U[i], W[i]);
v[U[i]].ppb(V[i], W[i]);
}
for (int i=0; i<n; i++)
{
if (v[i].sz == 2) a++;
if (v[i].sz == 1) b++;
}
if (b == 2 && a + b == n) q = 0;
return ;
}
int getMinimumFuelCapacity(int X, int Y)
{
if (q)
{
return 1;
}
else return -1;
}