제출 #864868

#제출 시각아이디문제언어결과실행 시간메모리
864868salmonOlympic Bus (JOI20_ho_t4)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int f1d[210],b1d[210]; int fnd[210],bnd[210]; vector<int> adjlst[210]; vector<int> badjlst[210]; vector<int> tempadjlst[210]; vector<int> tempbadjlst[210]; int parent[210]; int p[210]; int N,M; vector<int> edge[50100]; int u, v, c, d; int inf = 2e9; vector<int> fpath; vector<int> bpath; priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq; int main(){ scanf(" %d",&N); scanf(" %d",&M); for(int i = 0; i < M; i++){ scanf(" %d",&u); scanf(" %d",&v); scanf(" %d",&c); scanf(" %d",&d); edge[i] = vector<int> {u,v,c,d}; adjlst[u].push_back(i); badjlst[v].push_back(i); } for(int i = 0; i < N; i++){ f1d[i] = inf; b1d[i] = inf; fnd[i] = inf; bnd[i] = inf; parent[i] = -1; } f1d[1] = 0; for(int i : adjlst[1]){ pq.push(make_pair(edge[i][2],i)); } while(!pq.empty()){ pair<int,int> ii = pq.top(); int i = edge[ii.second][1]; if(f1d[i] != inf){ continue; } f1d[i] = ii.first; parent[i] = edge[ii.second][0]; for(int j : adjlst[i]){ pq.push(f1d[i] + edge[j][2],j); } } fnd[N] = 0; for(int i : adjlst[N]){ pq.push(make_pair(edge[i][2],i)); } while(!pq.empty()){ pair<int,int> ii = pq.top(); int i = edge[ii.second][1]; if(fnd[i] != inf){ continue; } fnd[i] = ii.first; parent[i] = edge[ii.second][0]; for(int j : adjlst[i]){ pq.push(fnd[i] + edge[j][2],j); } } b1d[1] = 0 for(int i : badjlst[1]){ pq.push(make_pair(edge[i][2],i)); } while(!pq.empty()){ pair<int,int> ii = pq.top(); int i = edge[ii.second][0]; if(b1d[i] != inf){ continue; } b1d[i] = ii.first; parent[i] = edge[ii.second][1]; for(int j : badjlst[i]){ pq.push(b1d[i] + edge[j][2],j); } } bnd[N] = 0; for(int i : badjlst[N]){ pq.push(make_pair(edge[i][2],i)); } while(!pq.empty()){ pair<int,int> ii = pq.top(); int i = edge[ii.second][0]; if(bnd[i] != inf){ continue; } bnd[i] = ii.first; parent[i] = edge[ii.second][1]; for(int j : badjlst[i]){ pq.push(bnd[i] + edge[j][2],j); } } long long int small = f1d[N] + (long long int) + fnd[1]; for(int i = 0; i < M; i++){ small = min(small, min(f1d[N], f1d[edge[i][0]] + bnd[edge[i][1]] ) + min(fnd[1], fnd[edge[i][0]] + b1d[edge[i][1]] )); } printf("%lld",small); }

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

ho_t4.cpp: In function 'int main()':
ho_t4.cpp:63:42: error: no matching function for call to 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >::push(int, int&)'
   63 |             pq.push(f1d[i] + edge[j][2],j);
      |                                          ^
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from ho_t4.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::greater<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:7: note:   candidate expects 1 argument, 2 provided
/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::greater<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:7: note:   candidate expects 1 argument, 2 provided
ho_t4.cpp:86:42: error: no matching function for call to 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >::push(int, int&)'
   86 |             pq.push(fnd[i] + edge[j][2],j);
      |                                          ^
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from ho_t4.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::greater<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:7: note:   candidate expects 1 argument, 2 provided
/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::greater<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:7: note:   candidate expects 1 argument, 2 provided
ho_t4.cpp:90:15: error: expected ';' before 'for'
   90 |     b1d[1] = 0
      |               ^
      |               ;
   91 | 
   92 |     for(int i : badjlst[1]){
      |     ~~~        
ho_t4.cpp:109:42: error: no matching function for call to 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >::push(int, int&)'
  109 |             pq.push(b1d[i] + edge[j][2],j);
      |                                          ^
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from ho_t4.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::greater<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:7: note:   candidate expects 1 argument, 2 provided
/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::greater<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:7: note:   candidate expects 1 argument, 2 provided
ho_t4.cpp:132:42: error: no matching function for call to 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >::push(int, int&)'
  132 |             pq.push(bnd[i] + edge[j][2],j);
      |                                          ^
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from ho_t4.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::greater<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:7: note:   candidate expects 1 argument, 2 provided
/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::greater<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:7: note:   candidate expects 1 argument, 2 provided
ho_t4.cpp:138:125: error: no matching function for call to 'min(long long int&, int)'
  138 |         small = min(small, min(f1d[N], f1d[edge[i][0]] + bnd[edge[i][1]] ) + min(fnd[1], fnd[edge[i][0]] + b1d[edge[i][1]] ));
      |                                                                                                                             ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from ho_t4.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
ho_t4.cpp:138:125: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
  138 |         small = min(small, min(f1d[N], f1d[edge[i][0]] + bnd[edge[i][1]] ) + min(fnd[1], fnd[edge[i][0]] + b1d[edge[i][1]] ));
      |                                                                                                                             ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from ho_t4.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
ho_t4.cpp:138:125: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
  138 |         small = min(small, min(f1d[N], f1d[edge[i][0]] + bnd[edge[i][1]] ) + min(fnd[1], fnd[edge[i][0]] + b1d[edge[i][1]] ));
      |                                                                                                                             ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from ho_t4.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
ho_t4.cpp:138:125: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  138 |         small = min(small, min(f1d[N], f1d[edge[i][0]] + bnd[edge[i][1]] ) + min(fnd[1], fnd[edge[i][0]] + b1d[edge[i][1]] ));
      |                                                                                                                             ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from ho_t4.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
ho_t4.cpp:138:125: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  138 |         small = min(small, min(f1d[N], f1d[edge[i][0]] + bnd[edge[i][1]] ) + min(fnd[1], fnd[edge[i][0]] + b1d[edge[i][1]] ));
      |                                                                                                                             ^
ho_t4.cpp:21:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |     scanf(" %d",&N);
      |     ~~~~~^~~~~~~~~~
ho_t4.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |     scanf(" %d",&M);
      |     ~~~~~^~~~~~~~~~
ho_t4.cpp:25:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |         scanf(" %d",&u);
      |         ~~~~~^~~~~~~~~~
ho_t4.cpp:26:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |         scanf(" %d",&v);
      |         ~~~~~^~~~~~~~~~
ho_t4.cpp:27:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |         scanf(" %d",&c);
      |         ~~~~~^~~~~~~~~~
ho_t4.cpp:28:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |         scanf(" %d",&d);
      |         ~~~~~^~~~~~~~~~