Submission #880324

# Submission time Handle Problem Language Result Execution time Memory
880324 2023-11-29T07:33:50 Z Mardonbekhazratov Cyberland (APIO23_cyberland) C++17
Compilation error
0 ms 0 KB
#include "cyberland.h"
#include<bits/stdc++.h>
#include <vector>
using namespace std;
#define int long long
const int INF=1e18;

double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) {
    vector<vector<pair<int,int>>>v(N);
    for(int i=0;i<N-1;i++){
        v[x[i]].push_back({y[i],c[i]});
        v[y[i]].push_back({x[i],c[i]});
    }
    vector<bool>vis(N,0);
    priority_queue<pair<int,int>>q;
    vector<int>dp(N,INF);
    dp[0]=0;
    q.push({0,0});
    while(!q.empty()){
        int x=q.top().second;
        q.pop();
        if(vis[x]) continue;
        vis[x]=true;
        for(auto [z,y]:v[x]){
            if(dp[x]+y<dp[z]){
                dp[z]=dp[x]+y;
                q.push({-dp[z],z});
            }
        }
    }
    if(dp[H]==INF) return -1;
    return 1.0*dp[H];
}

Compilation message

/usr/bin/ld: /tmp/ccjLawmP.o: in function `main':
grader.cpp:(.text.startup+0x696): undefined reference to `solve(int, int, int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status