There is a maze of size NxN.You need to find the shortest path from 'S' to 'E' making sure you reach all blue positions marked 'B' and do not reach any red position marked 'R'.If there is no path then print -1.
How to solve this problem??
How to solve this problem??
Similar problems:
http://codeforces.me/problemset/problem/8/C
http://acm.sgu.ru/problem.php?contest=0&problem=536