제출 #1054374

#제출 시각아이디문제언어결과실행 시간메모리
1054374Gangsta밀림 점프 (APIO21_jumps)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define pb push_back #define ff first #define ss second using namespace std; const int N = 2e5 + 1; int dis[N], n1; bool sub1 = 0; vector <int> v[N]; priority_queue <pair<int,int>> pq; void dij(int x){ pq.push({0,x}); dis[x] = 0; while(!pq.empty()){ int a = pq.top().ss; pq.pop(); for(auto i: v[a]){ if(dis[a] + i.ss < dis[i.ff]){ dis[i.ff] = dis[a] + i.ss; pq.push({-dis[i.ff],i.ff}); } } } } int minimum_jumps(int a, int b, int c, int d){ int mn = 1e9; for(int i = a; i <= b; i++){ for(int j = 1; j <= n1; j++) dis[j] = 0; dij(i); for(int j = c; j <= d; j++) mn = min(mn,dis[j]); } return mn; } void init(int n, vector <int> h){ n1 = n; for(int i = 0; i < n; i++){ for(int j = i+1; j < n; j++){ if(h[j] > h[i]){ v[h[i]].pb(h[j]); break; } } for(int j = i-1; j >= 0; j--){ if(h[j] > h[i]){ v[h[i]].pb(h[j]); break; } } } } // int main(){ // int n, q; // vector <int> v; // cin >> n; // for(int i = 0; i < n; i++){ // int x; // cin >> x; // v.pb(x); // } // init(n, v); // cin >> q; // while(q--){ // int a, b, c, d; // cin >> a >> b >> c >> d; // } // }

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

jumps.cpp: In function 'void dij(int)':
jumps.cpp:4:12: error: request for member 'second' in 'i', which is of non-class type 'int'
    4 | #define ss second
      |            ^~~~~~
jumps.cpp:24:18: note: in expansion of macro 'ss'
   24 |    if(dis[a] + i.ss < dis[i.ff]){
      |                  ^~
jumps.cpp:3:12: error: request for member 'first' in 'i', which is of non-class type 'int'
    3 | #define ff first
      |            ^~~~~
jumps.cpp:24:29: note: in expansion of macro 'ff'
   24 |    if(dis[a] + i.ss < dis[i.ff]){
      |                             ^~
jumps.cpp:3:12: error: request for member 'first' in 'i', which is of non-class type 'int'
    3 | #define ff first
      |            ^~~~~
jumps.cpp:25:11: note: in expansion of macro 'ff'
   25 |     dis[i.ff] = dis[a] + i.ss;
      |           ^~
jumps.cpp:4:12: error: request for member 'second' in 'i', which is of non-class type 'int'
    4 | #define ss second
      |            ^~~~~~
jumps.cpp:25:28: note: in expansion of macro 'ss'
   25 |     dis[i.ff] = dis[a] + i.ss;
      |                            ^~
jumps.cpp:3:12: error: request for member 'first' in 'i', which is of non-class type 'int'
    3 | #define ff first
      |            ^~~~~
jumps.cpp:26:21: note: in expansion of macro 'ff'
   26 |     pq.push({-dis[i.ff],i.ff});
      |                     ^~
jumps.cpp:3:12: error: request for member 'first' in 'i', which is of non-class type 'int'
    3 | #define ff first
      |            ^~~~~
jumps.cpp:26:27: note: in expansion of macro 'ff'
   26 |     pq.push({-dis[i.ff],i.ff});
      |                           ^~
jumps.cpp:26:30: error: no matching function for call to 'std::priority_queue<std::pair<int, int> >::push(<brace-enclosed initializer list>)'
   26 |     pq.push({-dis[i.ff],i.ff});
      |                              ^
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from jumps.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>, std::allocator<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>, std::allocator<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)
      |            ~~~~~~~~~~~~~^~~