제출 #976048

#제출 시각아이디문제언어결과실행 시간메모리
976048elotelo966사이버랜드 (APIO23_cyberland)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "cyberland.h" using namespace std; #define lim 100005 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: In function 'int dij(int)':
cyberland.cpp:17:11: error: 'OYY' was not declared in this scope
   17 |   dist[i]=OYY;
      |           ^~~
cyberland.cpp:26:21: error: 'const value_type' {aka 'const struct std::pair<int, int>'} has no member named 'se'
   26 |   int node=pq.top().se;
      |                     ^~
cyberland.cpp:31:21: error: 'struct std::pair<int, int>' has no member named 'se'
   31 |    if(dist[node]+go.se<dist[go.fi]){
      |                     ^~
cyberland.cpp:31:32: error: 'struct std::pair<int, int>' has no member named 'fi'
   31 |    if(dist[node]+go.se<dist[go.fi]){
      |                                ^~
cyberland.cpp:32:13: error: 'struct std::pair<int, int>' has no member named 'fi'
   32 |     dist[go.fi]=dist[node]+go.se;
      |             ^~
cyberland.cpp:32:31: error: 'struct std::pair<int, int>' has no member named 'se'
   32 |     dist[go.fi]=dist[node]+go.se;
      |                               ^~
cyberland.cpp:33:23: error: 'struct std::pair<int, int>' has no member named 'fi'
   33 |     pq.push({-dist[go.fi],go.fi});
      |                       ^~
cyberland.cpp:33:30: error: 'struct std::pair<int, int>' has no member named 'fi'
   33 |     pq.push({-dist[go.fi],go.fi});
      |                              ^~
cyberland.cpp:33:33: error: no matching function for call to 'std::priority_queue<std::pair<int, int> >::push(<brace-enclosed initializer list>)'
   33 |     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)
      |            ~~~~~~~~~~~~~^~~