Submission #1032353

# Submission time Handle Problem Language Result Execution time Memory
1032353 2024-07-23T16:03:50 Z slivajan Swapping Cities (APIO20_swap) C++17
0 / 100
1 ms 348 KB
#include "swap.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long un;
typedef vector<un> vuc;
typedef vector<bool> vol;

#define vec vector
#define REP(i, a, b) for (un i = (un)a; i < (un)b; i++)
#define FEAC(i, a) for (auto&& i : a)

constexpr un INF = 1e9 + 1;


vuc delky;
un nej;
un nej2;
un nej3;

void init(int N, int M, std::vector<int> U, std::vector<int> V, std::vector<int> W) {

    delky = vuc(N);

    REP(i, 0, M){
        delky[V[i]] = W[i];
    }

    vec<pair<un, un>> toSort;
    REP(i, 1, N){
        toSort.push_back({-delky[i], i});
    }

    sort(toSort.begin(), toSort.end());

    nej = toSort[0].second;
    nej2 = toSort[1].second;
    nej3 = toSort[2].second;
  
}

int getMinimumFuelCapacity(int X, int Y) {
  
    if (X > Y) swap(X, Y);

    if (X == 0) return getMinimumFuelCapacity(nej, Y);

    if (((X == nej) and (Y == nej2)) or ((Y == nej) and (X == nej2))){
        return max({delky[X], delky[Y], delky[nej3]});
    }

    if ((X == nej) or (Y == nej)) return max({delky[X], delky[Y], delky[nej2]});

    return max({delky[X], delky[Y], delky[nej]});
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -