제출 #658048

#제출 시각아이디문제언어결과실행 시간메모리
658048paulo_ar악어의 지하 도시 (IOI11_crocodile)C++14
컴파일 에러
0 ms0 KiB
#include "crocodile.h" #include <bits/stdc++.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; }

컴파일 시 표준 에러 (stderr) 메시지

crocodile.cpp:16:1: error: 'vector' does not name a type
   16 | vector <NODO> grafo [1000000];
      | ^~~~~~
crocodile.cpp: In function 'int bsf(int, int)':
crocodile.cpp:23:1: error: 'priority_queue' was not declared in this scope; did you mean 'std::priority_queue'?
   23 | priority_queue<NODO> datos;
      | ^~~~~~~~~~~~~~
      | std::priority_queue
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from crocodile.cpp:2:
/usr/include/c++/10/bits/stl_queue.h:456:11: note: 'std::priority_queue' declared here
  456 |     class priority_queue
      |           ^~~~~~~~~~~~~~
crocodile.cpp:23:20: error: expected primary-expression before '>' token
   23 | priority_queue<NODO> datos;
      |                    ^
crocodile.cpp:23:22: error: 'datos' was not declared in this scope
   23 | priority_queue<NODO> datos;
      |                      ^~~~~
crocodile.cpp:38:18: error: 'grafo' was not declared in this scope
   38 |     for(NODO j : grafo[u.a]){
      |                  ^~~~~
crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:64:12: error: expected ';' before 'i'
   64 | for(int i=1 i<=N; i++){
      |            ^~
      |            ;
crocodile.cpp:65:5: error: 'grafo' was not declared in this scope
   65 |     grafo[R[i][1]].push_back({R[i][2],L[i]});
      |     ^~~~~