NIT director is very frustrated of zeheris and he decided to call police to catch the all of them. Director consulted a psychologist to know the psychology of zeheris in order to make it easy for the police to catch them.They took help of a psychologist who can predict where the zeheri will move if he is in a particular section of NIT. for example if NIT is divided in a 2 X 2 Grid. Psychologist matrix might be
S S
N N
So, here if a person is at 1,1 he can only move to south. S represents that he will move to south N represents that he will move to north W represents that he will move to west E represents that he will move to east.
What is the minimum number of police jeeps required to catch all the zeheris. No of jeeps required here are two only.
PS: You may assume that no zeheri tend to move outside NIT.
Constriants : N<500 and t<50
Here, if a particular zeheri is at boundary then according to the psychology matrix he will move only on the boundary.
or if he is on (2,2) or (2,3)., he will toggle between two given blocks. So,only two police jeeps are required.