Submission #747423

# Submission time Handle Problem Language Result Execution time Memory
747423 2023-05-24T07:32:22 Z vjudge1 Swapping Cities (APIO20_swap) C++17
0 / 100
99 ms 10904 KB
#include "swap.h"

#include <bits/stdc++.h>

using namespace std;

vector<int> w1;
vector<pair<int,int>> w2;
bool bambusz;

void init(int N, int M,
    std::vector<int> U, std::vector<int> V, std::vector<int> W) {
    if(N <= 3)bambusz = true;
    w1.resize(N);
    w1[0] = 0;
    for(int i = 0; i < M; i++){
        w1[V[i]] = W[i];
    }
    for(int i = 0; i < M; i++){
        w2.push_back({W[i], V[i]});
    }
    sort(w2.begin(), w2.end());
}

int getMinimumFuelCapacity(int X, int Y) {
    if(bambusz)return -1;
    int mx = 0;
    if(X != 0) mx = max(mx, w1[X]);
    if(Y != 0) mx = max(mx, w1[Y]);
    int i = 0;
    if(X == w2[i].second || Y == w2[i].second)i++;
    if(X == w2[i].second || Y == w2[i].second)i++;
    return max(mx, w2[i].first);
}

/*

4 3
0 1 1
0 2 2
0 3 3
4
1 2
1 3
0 1
3 0

*/

# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 212 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 0 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 88 ms 10168 KB Output is correct
4 Correct 86 ms 10640 KB Output is correct
5 Incorrect 99 ms 10904 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 212 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 0 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 212 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 0 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 212 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 0 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -