답안 #1041833

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1041833 2024-08-02T08:37:54 Z Muhammet 자매 도시 (APIO20_swap) C++17
0 / 100
163 ms 10740 KB
#include <bits/stdc++.h>
#include "swap.h"
using namespace std;

#define ll long long

const int N = 100005;

ll n, m, v[N];

multiset <ll> s;

void init(int n1, int m1, vector<int> u1, vector<int> v1, vector<int> w1) {
    m = m1;
    for(int i = 0; i < m1; i++){
        v[v1[i]] = (w1[i]);
        s.insert(w1[i]);
    }
}

int getMinimumFuelCapacity(int x, int y) {
    if(x > y) swap(x,y);
    ll ans = 0;
    if(x == 0){
        if(m > 1){
            ans = v[y];
            s.erase(s.find(v[y]));
            ans += 2*(*s.begin());
            s.insert(v[y]);
            return ans;
        }
        else {
            return -1;
        }
    }
    if(m <= 2) return -1;
    ans = (v[x]+v[y]);
    s.erase(s.find(v[x]));
    s.erase(s.find(v[y]));
    ans += 2*(*s.begin());
    s.insert(v[x]);
    s.insert(v[y]);
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 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 Incorrect 163 ms 10740 KB Output isn't correct
4 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 Incorrect 0 ms 348 KB Output isn't correct
4 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 Incorrect 0 ms 348 KB Output isn't correct
4 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 Incorrect 0 ms 348 KB Output isn't correct
4 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 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -