Submission #562629

# Submission time Handle Problem Language Result Execution time Memory
562629 2022-05-14T20:26:30 Z Iwanttobreakfree Crocodile's Underground City (IOI11_crocodile) C++
0 / 100
1 ms 212 KB
#include <iostream>
#include <vector>
#include <queue>
#include "crocodile.h"
using namespace std;
typedef long long ll;
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
    vector<pair<ll,ll>> d(N,{1e18,1e18});
    vector<vector<pair<int,int>>> g(N,vector<pair<int,int>>());
    for(int i=0;i<M;i++){
        g[R[i][0]].push_back({R[i][1],L[i]});
        g[R[i][1]].push_back({R[i][0],L[i]});
    }
    priority_queue<pair<ll,int>> pq;
    for(int i=0;i<K;i++)pq.push({0,P[i]});
    while(pq.empty()){
        ll dist=-pq.top().first,u=pq.top().second;
        pq.pop();
        if(dist>d[u].second)continue;
        for(auto v:g[u]){
            if(dist+v.second<d[v.first].first){
                d[v.first].second=d[v.first].first;
                d[v.first].first=dist+v.second;
                pq.push({-d[v.first].second,v.first});
            }
            if(dist+v.second<d[v.first].second){
                d[v.first].second=dist+v.second;
                pq.push({-d[v.first].second,v.first});
            }
        }
    }
    return d[0].second;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -