Submission #984101

# Submission time Handle Problem Language Result Execution time Memory
984101 2024-05-16T10:05:45 Z Rafiullah Cyberland (APIO23_cyberland) C++17
0 / 100
1203 ms 2097152 KB
#include "cyberland.h"

#include <bits/stdc++.h>
using namespace std;
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> A) {
    int n ,m , k,h;cin>>n>>m>>k>>h;
    map<int,vector<int>> graph;
    map<pair<int,int>,int> weight;
    double dist[n];
    for(int i = 0 ;i <n ;i ++){
        dist[i] = 1e9;
    }
    for(int i = 0 ;i<m ;i ++){
        int a = x[i];
        int b = y[i];
        int cc = c[i];
        weight[{min(a,b),max(a,b)}] = cc;
        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();
        // cout<<graph[node].size()<<endl;
        for(int child:graph[node]){
            
            int W = weight[{min(node,child),max(node,child)}];
            // cout<<node<<" "<<child<<" "<<W<<endl;
            if(dist[node]+W<dist[child]){
                dist[child] = dist[node]+W;
                pq.push({-dist[child],child});
            }
        }
    }
    if(dist[h] == 1e9)dist[h] = -1;
    return dist[h];
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1203 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 224 ms 54292 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 871 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 860 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -