제출 #976046

#제출 시각아이디문제언어결과실행 시간메모리
976046elotelo966사이버랜드 (APIO23_cyberland)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "cyberland.h" using namespace std; int n,m,k,h; int vis[lim],dist[lim]; vector<pair<int,int>> v[lim]; inline int dij(int node){ for(int i=0;i<n;i++){ vis[i]=0; dist[i]=OYY; } priority_queue<pair<int,int>> pq; pq.push({0,0}); // cur distance --- cur node dist[0]=0; while(!pq.empty()){ int node=pq.top().se; pq.pop(); if(vis[node])continue; vis[node]=1; for(auto go:v[node]){ if(dist[node]+go.se<dist[go.fi]){ dist[go.fi]=dist[node]+go.se; pq.push({-dist[go.fi],go.fi}); } } } return dist[h]; } double solve(int N, int M, int K, int H,vector<int> x,vector<int> y,vector<int> c,vector<int> arr) { n=N;m=M;k=K;h=H; for(int i=0;i<m;i++){ v[x[i]].push_back({y[i],c[i]}); v[y[i]].push_back({x[i],c[i]}); } int cev=dij(0); for(int i=0;i<n;i++){ v[i].clear(); } return cev; }

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

cyberland.cpp:8:9: error: 'lim' was not declared in this scope
    8 | int vis[lim],dist[lim];
      |         ^~~
cyberland.cpp:8:19: error: 'lim' was not declared in this scope
    8 | int vis[lim],dist[lim];
      |                   ^~~
cyberland.cpp:10:25: error: 'lim' was not declared in this scope
   10 | vector<pair<int,int>> v[lim];
      |                         ^~~
cyberland.cpp: In function 'int dij(int)':
cyberland.cpp:14:3: error: 'vis' was not declared in this scope
   14 |   vis[i]=0;
      |   ^~~
cyberland.cpp:15:3: error: 'dist' was not declared in this scope
   15 |   dist[i]=OYY;
      |   ^~~~
cyberland.cpp:15:11: error: 'OYY' was not declared in this scope
   15 |   dist[i]=OYY;
      |           ^~~
cyberland.cpp:21:2: error: 'dist' was not declared in this scope
   21 |  dist[0]=0;
      |  ^~~~
cyberland.cpp:24:21: error: 'const value_type' {aka 'const struct std::pair<int, int>'} has no member named 'se'
   24 |   int node=pq.top().se;
      |                     ^~
cyberland.cpp:26:6: error: 'vis' was not declared in this scope
   26 |   if(vis[node])continue;
      |      ^~~
cyberland.cpp:27:3: error: 'vis' was not declared in this scope
   27 |   vis[node]=1;
      |   ^~~
cyberland.cpp:28:15: error: 'v' was not declared in this scope
   28 |   for(auto go:v[node]){
      |               ^
cyberland.cpp:31:33: error: no matching function for call to 'std::priority_queue<std::pair<int, int> >::push(<brace-enclosed initializer list>)'
   31 |     pq.push({-dist[go.fi],go.fi});
      |                                 ^
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from cyberland.cpp:1:
/usr/include/c++/10/bits/stl_queue.h:640:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::less<std::pair<int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<int, int>]'
  640 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:640:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<int, int>&'}
  640 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_queue.h:648:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::less<std::pair<int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<int, int>]'
  648 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:648:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'}
  648 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
cyberland.cpp: In function 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
cyberland.cpp:42:3: error: 'v' was not declared in this scope
   42 |   v[x[i]].push_back({y[i],c[i]});
      |   ^
cyberland.cpp:48:3: error: 'v' was not declared in this scope
   48 |   v[i].clear();
      |   ^