답안 #1065421

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1065421 2024-08-19T07:27:53 Z stdfloat 사이버랜드 (APIO23_cyberland) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "cyberland.h"
#include "stub.cpp"
using namespace std;
 
#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();
 
        if (x == H) continue;
 
        for (auto [i, w] : E[x]) {
            if (!vis0[i]) {
                q.push(i);
                vis0[i] = true;
            }
        }
    }
 
    if (!vis0[H]) return -1;
 
    K = min(K, 66);
 
    vector<double> dis(n, 1e18);
    priority_queue<pair<double, int>> pq;
    for (int i = 0; i < n; i++) {
        if (!i || (!a[i] && vis0[i])) {
            dis[i] = 0;
            pq.push({0, i});
        }
    }
    for (int ii = 0; ii <= K; ii++) {
        vector<double> ndis = dis;
        priority_queue<pair<double, int>> npq;
        while (!pq.empty()) {
            auto [d, x] = pq.top(); d = -d; pq.pop();
        
            if (d != dis[x] || x == H) continue;
        
            for (auto [i, w] : E[x]) {
                if (!a[i]) continue;
    
                if (d + w < dis[i]) {
                    dis[i] = d + w;
                    pq.push({-dis[i], i});
                }
                if (a[i] == 2 && ii < K && (d + w) / 2 < ndis[i]) {
                    ndis[i] = (d + w) / 2;
                    npq.push({-ndis[i], i});
                }
            }
        }

        pq = npq;
        for (int i = 0; i < n; i++) {
            dis[i] = min(dis[i], ndis[i]);
        }
    }

    return dis[H];
}

Compilation message

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