답안 #1060957

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1060957 2024-08-16T05:00:32 Z stdfloat 사이버랜드 (APIO23_cyberland) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "cyberland.h"
#include "stub.cpp"
using namespace std;

using ll = long long;

#define ff  first
#define ss  second
#define pii pair<int, int>

double solve(int n, int M, int K, int H, vector<int> X, vector<int> Y, vector<int> C, vector<int> a) {
    vector<pii> E[n];
    for (int i = 0; i < M; i++) {
        E[X[i]].push_back({Y[i], C[i]});
        E[Y[i]].push_back({X[i], C[i]});
    }

    queue<int> q;
    vector<bool> vis0(n);
    q.push(0); vis0[0] = true;
    while (!q.empty()) {
        int x = q.front(); q.pop();

        for (auto [i, w] : E[x]) {
            if (!vis0[i]) {
                q.push(i);
                vis0[i] = true;
            }
        }
    }

    vector<ll> dis(n, LLONG_MAX);
    priority_queue<pair<ll, int>> pq;
    dis[H] = 0; pq.push({0, H});
    while (!pq.empty()) {
        auto [d, x] = pq.top(); d = -d; pq.pop();
    
        if (d != dis[x]) continue;

        for (auto [i, w] : E[x]) {
            if (d + w < dis[i]) {
                dis[i] = d + w;
                pq.push({-dis[i], i});
            }
        }
    }

    if (dis[0] == LLONG_MAX) return -1;

    ll ans = dis[0];
    for (int i = 1; i < n; i++) {
        if (!a[i] && vis0[i]) ans = min(ans, dis[i]);
    }

    return ans;
}

Compilation message

cyberland.cpp:3:10: fatal error: stub.cpp: No such file or directory
    3 | #include "stub.cpp"
      |          ^~~~~~~~~~
compilation terminated.