제출 #389918

#제출 시각아이디문제언어결과실행 시간메모리
389918null_aweTracks in the Snow (BOI13_tracks)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; vector<int> dx{-1, 1, 0, 0}, dy{0, 0, -1, 1}; int main() { int h, w; cin >> h >> w; vector<string> field(h); vector<vector<int>> rank(h, vector<int>(w, 0)); for (int i = 0; i < h; ++i) cin >> field[i]; int m = 1; rank[0][0] = 1; deque<pair<int, int>> q; vector<int> first{0, 0}; q.push_back(first); while (!q.empty()) { pair<int, int> s = q.front(); m = max(m, rank[s.first][s.second]); q.pop_front(); for (int i = 0; i < 4; ++i) { int x = s.first + dx[i], y = s.second + dy[i]; if (x < 0 || y < 0 || x >= h || y >= w || rank[x][y] > 0 || field[x][y] == '.') continue; vector<int> add{x, y}; int r = rank[s.first][s.second]; if (field[s.first][s.second] == field[x][y]) { q.push_front(add); rank[x][y] = r; } else { q.push_back(add); rank[x][y] = r + 1; } } } cout << m; return 0; }

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

tracks.cpp: In function 'int main()':
tracks.cpp:16:20: error: no matching function for call to 'std::deque<std::pair<int, int> >::push_back(std::vector<int>&)'
   16 |   q.push_back(first);
      |                    ^
In file included from /usr/include/c++/9/deque:67,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:68,
                 from tracks.cpp:1:
/usr/include/c++/9/bits/stl_deque.h:1569:7: note: candidate: 'void std::deque<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::deque<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1569 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/9/bits/stl_deque.h:1569:35: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const value_type&' {aka 'const std::pair<int, int>&'}
 1569 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_deque.h:1584:7: note: candidate: 'void std::deque<_Tp, _Alloc>::push_back(std::deque<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::deque<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1584 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/9/bits/stl_deque.h:1584:30: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::deque<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'}
 1584 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
tracks.cpp:27:25: error: no matching function for call to 'std::deque<std::pair<int, int> >::push_front(std::vector<int>&)'
   27 |         q.push_front(add);
      |                         ^
In file included from /usr/include/c++/9/deque:67,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:68,
                 from tracks.cpp:1:
/usr/include/c++/9/bits/stl_deque.h:1532:7: note: candidate: 'void std::deque<_Tp, _Alloc>::push_front(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::deque<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1532 |       push_front(const value_type& __x)
      |       ^~~~~~~~~~
/usr/include/c++/9/bits/stl_deque.h:1532:36: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const value_type&' {aka 'const std::pair<int, int>&'}
 1532 |       push_front(const value_type& __x)
      |                  ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_deque.h:1547:7: note: candidate: 'void std::deque<_Tp, _Alloc>::push_front(std::deque<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::deque<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1547 |       push_front(value_type&& __x)
      |       ^~~~~~~~~~
/usr/include/c++/9/bits/stl_deque.h:1547:31: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::deque<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'}
 1547 |       push_front(value_type&& __x)
      |                  ~~~~~~~~~~~~~^~~
tracks.cpp:30:24: error: no matching function for call to 'std::deque<std::pair<int, int> >::push_back(std::vector<int>&)'
   30 |         q.push_back(add);
      |                        ^
In file included from /usr/include/c++/9/deque:67,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:68,
                 from tracks.cpp:1:
/usr/include/c++/9/bits/stl_deque.h:1569:7: note: candidate: 'void std::deque<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::deque<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1569 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/9/bits/stl_deque.h:1569:35: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const value_type&' {aka 'const std::pair<int, int>&'}
 1569 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_deque.h:1584:7: note: candidate: 'void std::deque<_Tp, _Alloc>::push_back(std::deque<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::deque<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1584 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/9/bits/stl_deque.h:1584:30: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::deque<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'}
 1584 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~