Submission #407304

# Submission time Handle Problem Language Result Execution time Memory
407304 2021-05-18T17:34:29 Z proma Swapping Cities (APIO20_swap) C++17
0 / 100
1 ms 204 KB
#include <bits/stdc++.h>

using namespace std;

vector <pair <int, int>> edge;
vector <int> weight;

void init (int N, int M, vector<int> U, vector<int> V, vector<int> W) {
    weight.resize(N);
    for (int i = 0; i < M; i ++) {
        edge.push_back({W[i], V[i]});
        weight[V[i]] = W[i];
    }
    sort(edge.begin(), edge.end());
}

int getMinimumFuelCapacity (int X, int Y) {
    if (!X or !Y) {
        return -1;
    }
    else {
        int max_weight = max(weight[X], weight[Y]);
        for (auto i: edge) {
            if (i.second != X and i.second != Y) {
                max_weight = max(max_weight, i.first);
                break;
            }
        }
        return max_weight;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct