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

Post by mukit » Mon Dec 22, 2008 7:53 am

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.

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

Re: 11561 - Getting Gold

Post by emotional blind » Mon Dec 22, 2008 8:22 am

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

Post by mukit » Mon Dec 22, 2008 8:30 am

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

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

Re: 11561 - Getting Gold

Post by emotional blind » Mon Dec 22, 2008 8:42 am

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

Post by mukit » Mon Dec 22, 2008 8:49 am

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 ?

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

Re: 11561 - Getting Gold

Post by emotional blind » Mon Dec 22, 2008 9:08 am

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

Post by mukit » Mon Dec 22, 2008 9:15 am

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

Post by mukit » Tue Dec 23, 2008 1:03 pm

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.

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

Re: 11561 - Getting Gold

Post by emotional blind » Tue Dec 23, 2008 3:13 pm

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

Post by mukit » Tue Dec 23, 2008 7:07 pm

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

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

Re: 11561 - Getting Gold

Post by emotional blind » Tue Dec 23, 2008 7:36 pm

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

Post by Obaida » Wed Dec 24, 2008 10:53 am

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

Post by Jan » Tue Dec 30, 2008 12:33 pm

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

Post by Obaida » Sun Jan 11, 2009 11:53 am

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

Post by Jan » Sun Jan 11, 2009 8:11 pm

Try the case.

Input:

Code: Select all

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

Code: Select all

5
Ami ekhono shopno dekhi...
HomePage

Post Reply

Return to “Volume 115 (11500-11599)”