Submission #628204

# Submission time Handle Problem Language Result Execution time Memory
628204 2022-08-13T08:05:47 Z abcvuitunggio Crocodile's Underground City (IOI11_crocodile) C++17
0 / 100
0 ms 212 KB
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
    ll INF=1e18,d[N][2];
    vector <pair <ll, ll> > ke[N];
    priority_queue<pair <ll, ll>, vector <pair <ll, ll> >, greater <pair <ll, ll> > > q;
    for (int i=0;i<M;i++)
        for (int j=0;j<2;j++)
            ke[R[i][j]].push_back({R[i][j^1],L[i]});
    for (int i=0;i<N;i++)
        d[i][0]=d[i][1]=INF;
    for (int i=0;i<K;i++){
        q.push({0,P[i]});
        d[P[i]][0]=d[P[i]][1]=0;
    }
    while (!q.empty()){
        ll u=q.top().first,du=q.top().second;
        q.pop();
        if (du!=d[u][0])
            continue;
        for (auto [v,w]:ke[u]){
            if (d[u][0]>d[v][1]+w){
                d[u][1]=d[u][0];
                d[u][0]=d[v][1]+w;
                q.push({d[u][0],u});
            }
            else if (d[u][1]>d[v][1]+w)
                d[u][1]=d[v][1]+w;
        }
    }
    return d[0][1];
}


# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -