In a war of Wasseypur, Faizal Khan was desperate to kill Sultan. He already knew Sultan was going to attack him.
Sultan has to meet an important person in Kabal Bagh. Since Faizal Khan somehow, is aware of Sultan's meeting, he has planted master-bombs in the park. Sultan, somehow, had the premonition of Faizal's plan.
He took along with him bomb diffuser.
But each Master bomb is surrounded by either wall or bombs on each side (north,east,west,south).
As soon as Sultan reaches the garden he notes down the coordinates of the bombs that have been planted.
Now he has to count the Master bombs that have been placed on the area.
Given position of all the bombs help Sultan to count the number of Master Bombs so that he can diffuse them.
First line contains t, the number of test cases. The next line contains n, the number of bombs in the grid. Next n lines contain the coordinates of the bombs (xi,yi).
Output the number of Master bombs.
1<=t<=10 1<=n<=500 0<= xi,yi<=200
Input: 2 5 1 1 0 1 1 0 6 1 1 9 8 1 1 4 2 3 1 1 2 0 2 0 1 1 0 1 3 Output: 1 2
|Time Limit:||0.1 - 0.160131 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, JAVA, GO|
Fetching successful submissions