# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
659688 | paulo_ar | Crocodile's Underground City (IOI11_crocodile) | C++14 | 626 ms | 72432 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 [1000005];
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<M; i++){
grafo[R[i][0]].push_back({R[i][1],L[i]});
grafo[R[i][1]].push_back({R[i][0],L[i]});
}
for(int i=0; i<K; i++){
visitados[P[i]]=1;
for (auto e : grafo[P[i]]){
datos.push(e);
}
}
NODO u,v;
while(!datos.empty()){
u=datos.top();
datos.pop();
// cout<<u.a<<" "<<u.b<<"\n";
estado[u.a]++;
if(estado[u.a]>1){
if(visitados[u.a]==0){
visitados[u.a]=1;
distancias[u.a]=u.b;
for(auto e: grafo[u.a]){
if(visitados[e.a]==0){
datos.push({e.a,u.b+e.b});
}
}
}
}
/*
for(int i=0; i<=N; i++){
cout<<distancias[i]<<" ";
}
cout<<"\n";*/
}
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... |