Submission #965398

# Submission time Handle Problem Language Result Execution time Memory
965398 2024-04-18T12:46:47 Z hirayuu_oj Crocodile's Underground City (IOI11_crocodile) C++17
0 / 100
1 ms 4596 KB
#include "crocodile.h"
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(x) x.begin(),x.end();
using ll=long long;
const ll INF=1LL<<60;
using pll=pair<ll,ll>;

inline void srt(array<ll,3> &arr){
    arr[1]=min(arr[1],arr[2]);
    if(arr[0]>arr[1]){
        swap(arr[0],arr[1]);
    }
}
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
    vector<array<ll,3>> order(N,{INF,INF,INF});
    priority_queue<pll,vector<pll>,greater<pll>> vert;
    vector<ll> dist(N,INF);
    rep(i,K){
        dist[P[i]]=0;
        order[P[i]]={0,0,0};
        vert.push(pll(0,P[i]));
    }
    vector<vector<pll>> gr(N);
    rep(i,M){
        gr[R[i][0]].emplace_back(pll(R[i][1],L[i]));
        gr[R[i][1]].emplace_back(pll(R[i][0],L[i]));
    }
    while(!vert.empty()){
        int pos;
        ll dis;
        tie(dis,pos)=vert.top();
        vert.pop();
        if(dist[pos]!=dis)break;
        for(auto &[t,l]:gr[pos]){
            order[t][2]=dis+l;
            srt(order[t]);
            if(dist[t]>order[t][1]){
                dist[t]=order[t][1];
                vert.push(pll(dist[t],t));
            }
        }
    }
    return dist[0];
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4596 KB Output isn't correct
2 Halted 0 ms 0 KB -