Codeforces Round 1133 (Div. 1, Div. 2) is coming soon! Register here. ×

EslamYassien's blog

By EslamYassien, 14 years ago, In English

I can't understand the problem. can anyone help me please :)

Problems link: http://www.codeforces.com/problemset/problem/196/B

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
14 years ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

Here's the main idea:

If you can reach cell (i,j) in maze A and also in some other maze B, then you can walk infinitely. This reduces the space of your BFS to N*N (a node in your BFS consists of (i,j,mazeNumber)).