답안 #963211

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
963211 2024-04-14T18:01:40 Z SuPythony 자매 도시 (APIO20_swap) C++17
0 / 100
101 ms 16932 KB
#include "swap.h"
#include <bits/stdc++.h>
using namespace  std;

vector<vector<pair<int,int>>> al;
int n,m;
vector<pair<int,int>> ew;
vector<int> ew2;

void init(int N, int M,
          vector<int> U, vector<int> V, vector<int> W) {
    al.assign(N+1,vector<pair<int,int>>());
    ew2.assign(N+1,0);
    for (int i=0; i<M; i++) {
        al[U[i]].push_back({V[i],W[i]});
        al[V[i]].push_back({U[i],W[i]});
        ew.push_back({W[i],V[i]});
        ew2[V[i]]=W[i];
    }
    n=N;
    m=M;
    sort(ew.begin(),ew.end());
}

int getMinimumFuelCapacity(int X, int Y) {
    if (m<=2) return -1;
    if (ew[0].second==X||ew[0].second==Y) {
        if (ew[1].second==X||ew[1].second==Y) {
            return max({ew[2].first,ew2[X],ew2[Y]});
        }
        return max({ew[1].first,ew2[X],ew2[Y]});
    }
    return max({ew[0].first,ew2[X],ew2[Y]});
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 1 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 81 ms 12688 KB Output is correct
4 Correct 101 ms 12960 KB Output is correct
5 Incorrect 97 ms 16932 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 1 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 1 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 1 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 1 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -