Submission #1030686

# Submission time Handle Problem Language Result Execution time Memory
1030686 2024-07-22T08:34:58 Z amine_aroua Cyberland (APIO23_cyberland) C++17
Compilation error
0 ms 0 KB
#include "cyberland.h"

#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
double solve(int N, int M, int K, int H, std::vector<int> x, std::vector<int> y, std::vector<int> c, std::vector<int> arr)
{
    vector<vector<pair<long long ,long long>>> adj(N);
    for(long long i = 0 ; i < M ; i++)
    {
        adj[x[i]].push_back({y[i] , c[i]});
        adj[y[i]].push_back({x[i] , c[i]});
    }
    priority_queue<pair<double , long long> , vector<pair<double , long long>> , greater<pair<double , long long>>> pq;
    vector<double> dist(N , 1e16);
    vector<bool> vis(N , 0));
    dist[0] = 0;
    pq.push({0 , 0});
    while(!pq.empty())
    {
        auto tp = pq.top();
        pq.pop();
        double d = tp.first ;
        long long node = tp.second;
        if(vis[node])
            continue;
        vis[node] = 1;
        for(auto [u , cost] : adj[node])
        {
            double nd = d + (double)cost;
            if(arr[u] == 0)
            {
                nd = 0;
            }
            if(nd < eps + dist[u])
            {
                dist[u] = nd;
                pq.push({nd , u});
            }
        }
    }
    double mn = dist[H];
    return (mn + eps >= 1e16 ? -1 : mn);
}

Compilation message

cyberland.cpp: In function 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
cyberland.cpp:16:28: error: expected ',' or ';' before ')' token
   16 |     vector<bool> vis(N , 0));
      |                            ^