이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |