Submission #659680

# Submission time Handle Problem Language Result Execution time Memory
659680 2022-11-19T03:43:19 Z paulo_ar Crocodile's Underground City (IOI11_crocodile) C++14
0 / 100
12 ms 23776 KB
#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++){
  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

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:38:10: warning: unused variable 'v' [-Wunused-variable]
   38 |   NODO u,v;
      |          ^
# Verdict Execution time Memory Grader output
1 Correct 12 ms 23764 KB Output is correct
2 Incorrect 12 ms 23776 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 12 ms 23764 KB Output is correct
2 Incorrect 12 ms 23776 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 12 ms 23764 KB Output is correct
2 Incorrect 12 ms 23776 KB Output isn't correct
3 Halted 0 ms 0 KB -