Submission #777852

# Submission time Handle Problem Language Result Execution time Memory
777852 2023-07-09T18:58:49 Z t6twotwo Swapping Cities (APIO20_swap) C++17
0 / 100
70 ms 5204 KB
#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 : y;
    }
    if (Y == 0) {
        return (a[X] == x || a[X] == y) ? z : y;
    }
    if (a[X] > a[Y]) {
        swap(X, Y);
    }
    return x == a[X] ? (y == a[Y] ? z : y) : x;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 296 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 70 ms 5204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 296 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 296 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 296 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 296 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -