"shooting" question in august cook off-2014

BELOW WRITTEN TEXT WAS MY CODE FOR THE SHOOTING QUESTION FOR AUGUST COOK OFF-2014
THE CODE WORKS ON MY COMPILER IF I TAKE TEST CASE=1 BUT DOES NOT LET ME INPUT ALL THE ARRAY ELEMENTS IF I TAKE REST CASES MORE THAN 1.
I TRIED CHECKING IT FOR ALL 3 SAMPLE INPUT-OUTPUT VALUES
EVERYTHING SEEMS OKAY.
CAN SOMEONE EXPLAIN ME THE FAULT IN THE CODE, IF ANY

#include<stdio.h>
int main()
{
int i,j,n,m,t,x,z,flag;char arr[50][50];
scanf("%d",&t);
for(z=1;z<=t;z++)
{
flag=0;
scanf("%d%d",&n,&m);
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
scanf("%ch",&arr[i][j]);
}

}

for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
if(arr[i][j]==‘L’)
{
for(x=0;x<=j;x++)
if(arr[i][x]==‘E’)
arr[i][x]=’.’;

	for(x=j;x<m;x++)
	if(arr[i][x]=='E')
	arr[i][x]='.';

	for(x=0;x<=i;x++)
	if(arr[x][j]=='E')
	arr[x][j]='.';
   }
 }

}
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
if(arr[i][j]==‘E’)
flag++;
}
}
if(flag==0)
printf(“impossible\n”);
else
printf(“possible\n”);
}
return 0;
}

You can’t ask any question or program when the contest is on. So, When contest will ended then we can help you.

Happy coding .

You are printing “impossible” instead of “Impossible”.

Actually the laser can fire in only “one of the three directions” while the code you have written is based on the assumption that it fires in all three directions.

It’s a character array. So, after you scan the number of rows and columns, you would press either enter or space which is a character. So, use getchar and also use getchar after scanning every row if you are pressing enter after giving the row elements. Also, the laser can fire in only one direction and not all the three.