Submission #1187907

#TimeUsernameProblemLanguageResultExecution timeMemory
1187907versesrevTracks in the Snow (BOI13_tracks)C++20
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> #include <string> #include <deque> #include <tuple> int main() { int h, w; std::cin >> h >> w; std::vector<std::string> grid(h); for (auto& s : grid) std::cin >> s; int ans = 1; int dr[4] = {1, 0, -1, 0}; int dc[4] = {0, 1, 0, -1}; int cur = 0; std::deque<std::tuple<int, int>> que[2]; std::vector<std::vector<bool>> vis(h, std::vector<bool>(w)); que[cur].push_back(0, 0), vis[0][0] = true; while (not que[cur].empty() or not que[cur^1].empty()) { if (que[cur].empty()) { cur ^= 1, ++ans; } auto [r, c] = que[cur].front(); que[cur].pop_front(); for (int k = 0; k < 4; ++k) { int nr = r + dr[k]; int nc = c + dc[k]; if (nr < 0 or h <= nr or nc < 0 or w <= nc or vis[nr][nc] or '.' == grid[nr][nc]) continue; int nq = cur ^ (grid[nr][nc] != grid[r][c]); que[nq].push_back(nr, nc); vis[nr][nc] = true; } } std::cout << ans << "\n"; }

Compilation message (stderr)

tracks.cpp: In function 'int main()':
tracks.cpp:19:21: error: no matching function for call to 'std::deque<std::tuple<int, int> >::push_back(int, int)'
   19 |   que[cur].push_back(0, 0), vis[0][0] = true;
      |   ~~~~~~~~~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/11/deque:67,
                 from tracks.cpp:4:
/usr/include/c++/11/bits/stl_deque.h:1496:7: note: candidate: 'void std::deque<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::tuple<int, int>; _Alloc = std::allocator<std::tuple<int, int> >; std::deque<_Tp, _Alloc>::value_type = std::tuple<int, int>]'
 1496 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/11/bits/stl_deque.h:1496:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/11/bits/stl_deque.h:1511:7: note: candidate: 'void std::deque<_Tp, _Alloc>::push_back(std::deque<_Tp, _Alloc>::value_type&&) [with _Tp = std::tuple<int, int>; _Alloc = std::allocator<std::tuple<int, int> >; std::deque<_Tp, _Alloc>::value_type = std::tuple<int, int>]'
 1511 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/11/bits/stl_deque.h:1511:7: note:   candidate expects 1 argument, 2 provided
tracks.cpp:34:24: error: no matching function for call to 'std::deque<std::tuple<int, int> >::push_back(int&, int&)'
   34 |       que[nq].push_back(nr, nc);
      |       ~~~~~~~~~~~~~~~~~^~~~~~~~
In file included from /usr/include/c++/11/deque:67,
                 from tracks.cpp:4:
/usr/include/c++/11/bits/stl_deque.h:1496:7: note: candidate: 'void std::deque<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::tuple<int, int>; _Alloc = std::allocator<std::tuple<int, int> >; std::deque<_Tp, _Alloc>::value_type = std::tuple<int, int>]'
 1496 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/11/bits/stl_deque.h:1496:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/11/bits/stl_deque.h:1511:7: note: candidate: 'void std::deque<_Tp, _Alloc>::push_back(std::deque<_Tp, _Alloc>::value_type&&) [with _Tp = std::tuple<int, int>; _Alloc = std::allocator<std::tuple<int, int> >; std::deque<_Tp, _Alloc>::value_type = std::tuple<int, int>]'
 1511 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/11/bits/stl_deque.h:1511:7: note:   candidate expects 1 argument, 2 provided