답안 #827223

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
827223 2023-08-16T10:00:35 Z SUNWOOOOOOOO 자매 도시 (APIO20_swap) C++17
0 / 100
87 ms 9712 KB
#include "swap.h"
#include <bits/stdc++.h>
using namespace std;
using pint = pair <int, int>;
const int mxN = 100005, INF = 2e9;
pint e1 = {-1, INF}, e2 = {-1, INF}, e3 = {-1, INF};
int n, edge[mxN];

void init(int N, int M, vector<int> U, vector<int> V, vector<int> W) {
    n = N;
    for (int i = 0; i < N - 1; i++) edge[V[i]] = W[i];
    for (int i = 1; i <= N - 1; i++){
        if (edge[i] <= e1.second){
            e3 = e2, e2 = e1, e1 = {i, edge[i]};
        }
        else if (edge[i] <= e2.second){
            e3 = e2, e2 = {i, edge[i]};
        }
        else if (edge[i] <= e3.second){
            e3 = {i, edge[i]};
        }
    }
}

int getMinimumFuelCapacity(int X, int Y) {
    if (X == 0 || Y == 0 || n <= 3) return -1;
    if (X != e1.first && Y != e1.first) return max(max(edge[X], edge[Y]), e1.second);
    else if (X != e2.first && Y != e2.first) return max(max(edge[X], edge[Y]), e2.second);
    else return max(max(edge[X], edge[Y]), e3.second);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 304 KB Output is correct
4 Incorrect 1 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 87 ms 9712 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 304 KB Output is correct
4 Incorrect 1 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 304 KB Output is correct
4 Incorrect 1 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 304 KB Output is correct
4 Incorrect 1 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 304 KB Output is correct
4 Incorrect 1 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -