## 11561 - Getting Gold

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

Moderator: Board moderators

mukit
New poster
Posts: 48
Joined: Wed Nov 21, 2007 10:09 am
Location: Dhaka , Bangladesh
Contact:

### 11561 - Getting Gold

Hi, I'm getting W.A in this problem. Please give some I/O.

Code: Select all

``````Cut ...
``````
Thank's in advance.
Last edited by mukit on Tue Dec 23, 2008 7:04 pm, edited 1 time in total.

emotional blind
A great helper
Posts: 383
Joined: Mon Oct 18, 2004 8:25 am
Location: Bangladesh
Contact:

### Re: 11561 - Getting Gold

Code: Select all

``````               if(maze[i-1][j]=='T' || maze[i][j-1]=='T' || maze[i+1][j]=='T' || maze[i][j+1]=='T')
{
maze[i][j] = 0;
} ``````
Probably you are pointing out of maze..

mukit
New poster
Posts: 48
Joined: Wed Nov 21, 2007 10:09 am
Location: Dhaka , Bangladesh
Contact:

### Re: 11561 - Getting Gold

Could you please explain ?
I started value of i and j from 1.

emotional blind
A great helper
Posts: 383
Joined: Mon Oct 18, 2004 8:25 am
Location: Bangladesh
Contact:

### Re: 11561 - Getting Gold

Do you think maze[i+1][j] is always indexing within your maze?
When i = n, then it is indexing maze[n+1][j], but your maze is [1][1] to [n][m], right?

mukit
New poster
Posts: 48
Joined: Wed Nov 21, 2007 10:09 am
Location: Dhaka , Bangladesh
Contact:

### Re: 11561 - Getting Gold

but my maze size is 53 (maze[53][53]) larger than given limit (3 to 50). First I set all element of maze to 0 (using memset).
So when maze[i+1][j] is called, this dosen't exceed maze. Could please explain ?

emotional blind
A great helper
Posts: 383
Joined: Mon Oct 18, 2004 8:25 am
Location: Bangladesh
Contact:

### Re: 11561 - Getting Gold

Code: Select all

``````      else if(maze[i][j-1]=='L')
{
_count++;
``````
Is this correct?

mukit
New poster
Posts: 48
Joined: Wed Nov 21, 2007 10:09 am
Location: Dhaka , Bangladesh
Contact:

### Re: 11561 - Getting Gold

sorry, i don't understand.
Here I indicated 'L' as the position where there is a gold beside a trap.
So, after getting gold it increments it's counter and return's back to avoid trap.

mukit
New poster
Posts: 48
Joined: Wed Nov 21, 2007 10:09 am
Location: Dhaka , Bangladesh
Contact:

### Re: 11561 - Getting Gold

whatever, I updated my code using scanf instead of cin. But still WA. Someone please give some I/O.

Code: Select all

``````Cut ...
``````
Thank's in advance.
Last edited by mukit on Tue Dec 23, 2008 7:05 pm, edited 1 time in total.

emotional blind
A great helper
Posts: 383
Joined: Mon Oct 18, 2004 8:25 am
Location: Bangladesh
Contact:

### Re: 11561 - Getting Gold

Consider this case

Code: Select all

``````4 4
####
#TP#
#GG#
####``````
Output should be 0(zero).

mukit
New poster
Posts: 48
Joined: Wed Nov 21, 2007 10:09 am
Location: Dhaka , Bangladesh
Contact:

### Re: 11561 - Getting Gold

Thank's a lot emotional blind. That was the case I caught.
Now rank 12 in this problem.

emotional blind
A great helper
Posts: 383
Joined: Mon Oct 18, 2004 8:25 am
Location: Bangladesh
Contact:

### Re: 11561 - Getting Gold

have fun and keep posting

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

### Re: 11561 - Getting Gold

Some one please help me I got WA!!!!

Code: Select all

``removed``
Last edited by Obaida on Sun Jan 11, 2009 11:54 am, edited 1 time in total.
try_try_try_try_&&&_try@try.com
This may be the address of success.

Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

### Re: 11561 - Getting Gold

Try the cases.

Input:

Code: Select all

``````8 4
########
#.T.TGT#
#.G..P.#
########
7 8
#######
#P...T#
#...G.#
#G.T..#
#.....#
#G..T.#
#.....#
#######
``````
Output:

Code: Select all

``````1
2``````
Hope these help.
Ami ekhono shopno dekhi...
HomePage

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

### Re: 11561 - Getting Gold

I edited my code, but still WA!!!!

Code: Select all

``removed``
Last edited by Obaida on Mon Jan 12, 2009 6:48 am, edited 1 time in total.
try_try_try_try_&&&_try@try.com
This may be the address of success.

Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

### Re: 11561 - Getting Gold

Try the case.

Input:

Code: Select all

``````6 5
######
#TG..#
#TG.G#
#TGPG#
######
``````
Output:

Code: Select all

``5``
Ami ekhono shopno dekhi...
HomePage