Skip to content

Commit

Permalink
Update cat-and-mouse.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
kamyu104 authored Jan 17, 2021
1 parent ad21601 commit b2707f6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions C++/cat-and-mouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ class Solution {
Lookup color;
queue<tuple<int, int, int, int>> q;
for(int i = 0; i < size(graph); ++i) {
if (i == HOLE) {
continue;
}
for (const auto& t : {MOUSE, CAT}) {
color[make_tuple(HOLE, i, t)] = MOUSE;
q.emplace(HOLE, i, t, MOUSE);
if (i != HOLE) {
color[make_tuple(i, i, t)] = CAT;
q.emplace(i, i, t, CAT);
}
color[make_tuple(i, i, t)] = CAT;
q.emplace(i, i, t, CAT);
}
}
while (!empty(q)) {
Expand Down

0 comments on commit b2707f6

Please sign in to comment.