#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];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
70 ms |
5872 KB |
Output is correct |
4 |
Correct |
70 ms |
9632 KB |
Output is correct |
5 |
Correct |
74 ms |
10148 KB |
Output is correct |
6 |
Correct |
74 ms |
9616 KB |
Output is correct |
7 |
Correct |
73 ms |
10028 KB |
Output is correct |
8 |
Correct |
69 ms |
9760 KB |
Output is correct |
9 |
Correct |
70 ms |
9824 KB |
Output is correct |
10 |
Correct |
70 ms |
9768 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |