Submission #983871

# Submission time Handle Problem Language Result Execution time Memory
983871 2024-05-16T07:35:00 Z Rafiullah Cyberland (APIO23_cyberland) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define ll long long 
void solve(){
    int n ,m , k,h;cin>>n>>m>>k>>h;
    map<int,vector<int>> graph;
    map<pair<int,int>,int> weight;
    int X[n];
    int Y[n];
    int C[n];
    for(int i = 0 ;i <m ;i ++){
        cin>>X[i];
    }
    for(int i = 0 ;i <m ; i++){
        cin>>Y[i];
    }
    for(int i= 0 ; i<m ;i ++){
        cin>>C[i];
    }
    int A[n];
    int dist[n];
    for(int i = 0 ;i <n ;i ++){
        dist[i] = 1e9;
        cin>>A[i];
    }
    for(int i = 0 ;i < m ;i ++){
        int a = X[i];
        int b = Y[i];
        int c = C[i];
        weight[{min(a,b),max(a,b)}] = c;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    priority_queue<pair<int,int>> pq;
    dist[0]=0;
    pq.push({0,0});
    while(pq.size()>0){
        int node = pq.top().second;
        pq.pop();
        for(int child:graph[node]){
            int W = weight[{min(node,child),max(node,child)}];
            if(dist[node]+W<dist[child]){
                dist[child] = dist[node]+W;
                pq.push({-dist[child],child});
            }
        }
    }
    cout<<dist[h]<<endl;
}
signed main(){
    int t = 1;
    cin >> t;
    while (t--){
        solve();
    }
}

Compilation message

/usr/bin/ld: /tmp/ccxUPjxk.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc9GAmyk.o:cyberland.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccxUPjxk.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