Submission #658047

#TimeUsernameProblemLanguageResultExecution timeMemory
658047paulo_arCrocodile's Underground City (IOI11_crocodile)C++14
Compilation error
0 ms0 KiB
#include "crocodile.h"

struct NODO {
int a,b;

const bool operator< (const NODO &otro)const{

return b<otro.b;

}


};

vector <NODO> grafo [1000000];
int visitados [100005];
int distancias [100005];


int bsf (int a1, int b1){

priority_queue<NODO> datos;

datos.push({a1,b1});
bool res=true;
int r=0;
NODO u,v;
while(res && !datos.empty()){

    u=datos.top();
    datos.pop();
    if(visitados[u.a]==1){
        continue;
    }
    visitados[u.a]=1;
    bool op=false;
    for(NODO j : grafo[u.a]){
        if(op==false){
            op=true;
            continue;
        }
        if(visitados[j.a]==0 or visitados[j.a]==-9){
            v.a=j.a;
            v.b=u.b+j.b;

            if(visitados[j.a]==-9){
                res=false;
                r=v.b;
                break;
            }

            datos.push(v);
        }
    }

}
return r;
}


int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){

for(int i=1 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=1; i<=K; i++){
    visitados[P[i]]=-9;
 }

    N=bsf(0,0);


  return N;
}

Compilation message (stderr)

crocodile.cpp:15:1: error: 'vector' does not name a type
   15 | vector <NODO> grafo [1000000];
      | ^~~~~~
crocodile.cpp: In function 'int bsf(int, int)':
crocodile.cpp:22:1: error: 'priority_queue' was not declared in this scope
   22 | priority_queue<NODO> datos;
      | ^~~~~~~~~~~~~~
crocodile.cpp:22:20: error: expected primary-expression before '>' token
   22 | priority_queue<NODO> datos;
      |                    ^
crocodile.cpp:22:22: error: 'datos' was not declared in this scope
   22 | priority_queue<NODO> datos;
      |                      ^~~~~
crocodile.cpp:37:18: error: 'grafo' was not declared in this scope
   37 |     for(NODO j : grafo[u.a]){
      |                  ^~~~~
crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:63:12: error: expected ';' before 'i'
   63 | for(int i=1 i<=N; i++){
      |            ^~
      |            ;
crocodile.cpp:64:5: error: 'grafo' was not declared in this scope
   64 |     grafo[R[i][1]].push_back({R[i][2],L[i]});
      |     ^~~~~