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 int
#define pl pair<ll, ll>
#define llv vector<ll>
#define pb push_back
#define ppb(x, y) push_back({x, y})
#define pv vector<pl>
#define sz size()
#define ss second
#define ff first
using namespace std;
const int N = 2 * 1e5 + 3;
bool f = 0, f1 = 1;
pv v;
llv w[N];
int a[N], b, k = 0, q = 0, p = 0;
void init(int N, int M, vector<int> U, vector<int> V, vector<int> W)
{
for (int i=0; i<M; i++)
{
w[V[i]].pb(U[i]);
w[U[i]].pb(V[i]);
}
for (int i=0; i<N; i++)
{
if (w[i].sz == 2) q++;
if (w[i].sz == 1) p++;
}
if (p == 2 && q + p == N) f = 1;
for (int i=0; i<M; i++) v.ppb(W[i], V[i]);
sort(v.begin(), v.end());
b = v[2].ff;
for (int i=0; i<M; i++) a[V[i]] = W[i];
for (int i=0; i<M; i++)
k = max(k, W[i]);
f1 = (N == M);
return ;
}
int getMinimumFuelCapacity(int X, int Y)
{
if (f) return -1;
if (f1) return k;
return max({b, a[X], a[Y]});
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |