11352 - Crazy King

All about problems in Volume 113. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

moudud99
New poster
Posts: 28
Joined: Fri Feb 08, 2013 1:40 pm

Re: 11352 - Crazy King

Post by moudud99 »

I tried it with BFS.I think my code is ok but I am getting WA. please help me
thanks in advance.

Code: Select all

You rock lighted
removed after AC
Last edited by moudud99 on Sat Jul 26, 2014 10:39 am, edited 1 time in total.
lighted
Guru
Posts: 587
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 11352 - Crazy King

Post by lighted »

Your memset way is wrong.

Code: Select all

for(i=0; i<201; i++)
{
   memset(grid[i],0,200);
}
It must be

Code: Select all

for(i=0; i<201; i++)
{
    memset(grid[i], 0, 200 * sizeof(int));
}
Or it must be

Code: Select all

for(i=0; i<201; i++)
{
    memset(grid[i], 0, sizeof(grid[i]));
}
Or this way

Code: Select all

memset(grid, 0, sizeof(grid));
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
shuvokr
Learning poster
Posts: 66
Joined: Tue Oct 02, 2012 8:16 pm
Location: Bangladesh

Re: 11352 - Crazy King

Post by shuvokr »

@SONNET_N try this case

Code: Select all

Sample Input:
1
5 3
...
Z..
Z..
Z.B
..A

Sample Output:
Minimal possible length of a trip is 1

Code: Select all

enjoying life ..... 
Post Reply

Return to “Volume 113 (11300-11399)”