Submission #1187888

#TimeUsernameProblemLanguageResultExecution timeMemory
1187888versesrevTracks in the Snow (BOI13_tracks)C++20
Compilation error
0 ms0 KiB
#include <iostream>
#include <vector>
#include <string>
#include <priority_queue>
#include <array>

int main() {
  int h, w;
  std::cin >> h >> w;
  std::vector<std::string> grid(h);
  for (auto& s : grid) std::cin >> s;
  
  int and = 0;
  int dr[4] = {1, 0, -1, 0};
  int dc[4] = {0, 1, 0, -1};
  std::priority_queue<std::array<int, 3>> heap;
  std::vector<std::vector<bool>> vis(h, std::vector<bool>(w));
  heap.emplace(0, 0, 0), vis[0][0] = true;
  while (not heap.empty()) {
    auto [d, r, c] = heap.top();
    heap.pop();
    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 nd = d - (grid[nr][nc] == grid[r][c]);
      heap.emplace(nd, nr, nc);
      ans = std::max(ans, -d);
    }
  }
  std::cout << (ans + 1) << "\n";
}

Compilation message (stderr)

tracks.cpp:4:10: fatal error: priority_queue: No such file or directory
    4 | #include <priority_queue>
      |          ^~~~~~~~~~~~~~~~
compilation terminated.