Submission #628213

# Submission time Handle Problem Language Result Execution time Memory
628213 2022-08-13T08:13:33 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().second,du=q.top().first;
        q.pop();
        if (du!=d[u][0])
            continue;
        for (auto [v,w]:ke[u]){
            if (d[v][0]>d[u][1]+w){
                d[v][1]=d[v][0];
                d[v][0]=d[u][1]+w;
                q.push({d[v][0],v});
            }
            else if (d[v][1]>d[u][1]+w)
                d[v][1]=d[u][1]+w;
        }
    }
    return d[0][1];
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -