Submission #659688

# Submission time Handle Problem Language Result Execution time Memory
659688 2022-11-19T04:12:42 Z paulo_ar Crocodile's Underground City (IOI11_crocodile) C++14
100 / 100
626 ms 72432 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++){
  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

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:39:10: warning: unused variable 'v' [-Wunused-variable]
   39 |   NODO u,v;
      |          ^
# Verdict Execution time Memory Grader output
1 Correct 12 ms 23764 KB Output is correct
2 Correct 12 ms 23764 KB Output is correct
3 Correct 15 ms 23844 KB Output is correct
4 Correct 15 ms 23824 KB Output is correct
5 Correct 12 ms 23892 KB Output is correct
6 Correct 13 ms 23780 KB Output is correct
7 Correct 12 ms 23896 KB Output is correct
8 Correct 14 ms 23796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 23764 KB Output is correct
2 Correct 12 ms 23764 KB Output is correct
3 Correct 15 ms 23844 KB Output is correct
4 Correct 15 ms 23824 KB Output is correct
5 Correct 12 ms 23892 KB Output is correct
6 Correct 13 ms 23780 KB Output is correct
7 Correct 12 ms 23896 KB Output is correct
8 Correct 14 ms 23796 KB Output is correct
9 Correct 14 ms 24020 KB Output is correct
10 Correct 11 ms 23812 KB Output is correct
11 Correct 13 ms 23892 KB Output is correct
12 Correct 16 ms 24296 KB Output is correct
13 Correct 15 ms 24368 KB Output is correct
14 Correct 14 ms 23764 KB Output is correct
15 Correct 13 ms 23892 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 23764 KB Output is correct
2 Correct 12 ms 23764 KB Output is correct
3 Correct 15 ms 23844 KB Output is correct
4 Correct 15 ms 23824 KB Output is correct
5 Correct 12 ms 23892 KB Output is correct
6 Correct 13 ms 23780 KB Output is correct
7 Correct 12 ms 23896 KB Output is correct
8 Correct 14 ms 23796 KB Output is correct
9 Correct 14 ms 24020 KB Output is correct
10 Correct 11 ms 23812 KB Output is correct
11 Correct 13 ms 23892 KB Output is correct
12 Correct 16 ms 24296 KB Output is correct
13 Correct 15 ms 24368 KB Output is correct
14 Correct 14 ms 23764 KB Output is correct
15 Correct 13 ms 23892 KB Output is correct
16 Correct 542 ms 69568 KB Output is correct
17 Correct 74 ms 31884 KB Output is correct
18 Correct 97 ms 33420 KB Output is correct
19 Correct 626 ms 72432 KB Output is correct
20 Correct 391 ms 66120 KB Output is correct
21 Correct 44 ms 27408 KB Output is correct
22 Correct 339 ms 53288 KB Output is correct