Submission #963282

# Submission time Handle Problem Language Result Execution time Memory
963282 2024-04-14T20:10:21 Z SuPythony Crocodile's Underground City (IOI11_crocodile) C++17
0 / 100
8 ms 12632 KB
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;

vector<vector<pair<int,int>>> al(100000, vector<pair<int,int>>());
vector<int> vis(100000,0);

int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
    for (int i=0; i<M; i++) {
        int u=R[i][0], v=R[i][1];
        al[u].push_back({v, L[i]});
        al[v].push_back({u, L[i]});
    }
    vector<vector<int>> time(100000, vector<int>(2, 1e9));
    priority_queue<pair<int,int>,vector<pair<int,int>>,greater<>> pq;
    for (int i=0; i<K; i++) {
        pq.push({0,P[i]});
        time[P[i]][0]=time[P[i]][1]=0;
        vis[P[i]]=1;
    }
    while (!pq.empty()) {
        int u=pq.top().second; pq.pop();
        for (auto v: al[u]) {
            if (time[u][1]+v.second<=time[v.first][0]) {
                time[v.first][1]=time[v.first][0];
                time[v.first][0]=time[u][1]+v.second;
                pq.push({time[v.first][1],v.first});
            } else {
                if (time[u][1]+v.second<=time[v.first][1]) {
                    time[v.first][1]=time[u][1]+v.second;
                    pq.push({time[v.first][1],v.first});
                }
            }
        }
    }
    return time[0][1];
}
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 12632 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 12632 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 12632 KB Output isn't correct
2 Halted 0 ms 0 KB -