# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
658319 | Leo121 | Crocodile's Underground City (IOI11_crocodile) | C++14 | 12 ms | 23892 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;
struct NODO {
int a,b;
const bool operator< (const NODO &otro)const{
return b<otro.b;
}
};
vector <NODO> grafo [1000000];
int visitados [100005];
int estado [100005];
int distancias [100005];
priority_queue<NODO> datos;
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
for(int i=0; i<N; i++){
grafo[R[i][1]].push_back({R[i][2],L[i]});
grafo[R[i][2]].push_back({R[i][1],L[i]});
}
for(int i=0; i<K; i++){
for (auto e : grafo[P[i]]){
datos.push(e);
visitados[e.a]=1;
}
}
NODO u,v;
while(!datos.empty()){
u=datos.top();
datos.pop();
for(auto e: grafo[u.a]){
if(visitados[e.a]==0){
estado[e.a]++;
if(estado[e.a]>1){
visitados[e.a]=1;
distancias[e.a]=u.b+e.b;
datos.push({e.a,distancias[e.a]});
}
}
}
}
N=distancias[0];
return N;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |