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 <bits/stdc++.h>
using namespace std;
typedef long long un;
typedef vector<un> vuc;
typedef vector<bool> vol;
#define vec vector
#define REP(i, a, b) for (un i = (un)a; i < (un)b; i++)
#define FEAC(i, a) for (auto&& i : a)
constexpr un INF = 1e9 + 1;
vuc delky;
un nej;
un nej2;
un nej3;
void init(int N, int M, std::vector<int> U, std::vector<int> V, std::vector<int> W) {
delky = vuc(N);
REP(i, 0, M){
delky[V[i]] = W[i];
}
vec<pair<un, un>> toSort;
REP(i, 1, N){
toSort.push_back({delky[i], i});
}
sort(toSort.begin(), toSort.end());
nej = toSort[0].second;
nej2 = toSort[1].second;
nej3 = toSort[2].second;
}
int getMinimumFuelCapacity(int X, int Y) {
if (X > Y) swap(X, Y);
if (X == 0) return getMinimumFuelCapacity(nej, Y);
if (((X == nej) and (Y == nej2)) or ((Y == nej) and (X == nej2))){
return max({delky[X], delky[Y], delky[nej3]});
}
if ((X == nej) or (Y == nej)) return max({delky[X], delky[Y], delky[nej2]});
return max({delky[X], delky[Y], delky[nej]});
}
# | 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... |