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;
int N, x, y, z;
vector<int> a;
constexpr int inf = 2e9;
void init(int n, int M, vector<int> U, vector<int> V, vector<int> W) {
N = n;
a.resize(N);
for (int i = 0; i < M; i++) {
a[V[i]] = W[i];
}
sort(W.begin(), W.end());
if (N >= 4) {
x = W[0];
y = W[1];
z = W[2];
}
}
int getMinimumFuelCapacity(int X, int Y) {
if (N < 4) {
return -1;
}
if (X == 0) {
return (a[Y] == x || a[Y] == y) ? z : a[Y];
}
if (Y == 0) {
return (a[X] == x || a[X] == y) ? z : a[X];
}
if (a[X] > a[Y]) {
swap(X, Y);
}
return x == a[X] ? (y == a[Y] ? z : a[Y]) : 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... |