10156 - Sala-ma-Sond, A Nice Little Pond

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

Moderator: Board moderators

Post Reply
Caesum
Experienced poster
Posts: 225
Joined: Fri May 03, 2002 12:14 am
Location: UK
Contact:

10156 - Sala-ma-Sond, A Nice Little Pond

Post by Caesum »

Seems like a relatively easy task and yet there are many wa's on this problem. Is there something here that I am not seeing ?
zsepi
Learning poster
Posts: 51
Joined: Thu Sep 26, 2002 7:43 pm
Location: Easton, PA, USA

Post by zsepi »

caesum is right, it didn't seem that difficult - however, I do get WA on it... is there any catch you can think about? is that possible that there is a command given to a turtle with non-existent id? but shouldn't one get runtime error (invalid memory reference) then? any ideas are welcome :)
Caesum
Experienced poster
Posts: 225
Joined: Fri May 03, 2002 12:14 am
Location: UK
Contact:

Post by Caesum »

My last submission had a lot of assert's and there is not such a case as far as I can tell - the commands appear to be all for valid id's
Caesum
Experienced poster
Posts: 225
Joined: Fri May 03, 2002 12:14 am
Location: UK
Contact:

Post by Caesum »

It seems that within the list of turtles some of them have the same id - do you just take the latest one ? do some of these extra positions end up as ghosts in the solutions or something ?
Caesum
Experienced poster
Posts: 225
Joined: Fri May 03, 2002 12:14 am
Location: UK
Contact:

Post by Caesum »

looks like it, i am now ac........ damn data is wrong for this problem
sumankar
A great helper
Posts: 286
Joined: Tue Mar 25, 2003 8:36 am
Location: calcutta
Contact:

WA :

Post by sumankar »

Can you elaborate a little further
Suman.
sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

10156 Sala-ma-Sond, A Frustrating Little Pond

Post by sohel »

This problem seems to be a straight forward one and the problem statement seems to be well written..
.. but I keep getting WA.... around 20 submissions so far. :(
-- and the AC % seems to be low as well, so there must be something that I have missed out.

I just check whether a command takes a turtle to a position in the grid that is not occupied by some other turtle and move it there correspondingly .. otherwise I ignore the command.

Some help or clarification will be greatly appreciated.
little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm

Post by little joey »

Yes, it should be as easy as you describe. Don't you have your north-south and east-west dimensions mixed up? That is about the only thing that can go wrong. I guess you already remove trailing spaces, and print a blank line after each case, including the last.
sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Post by sohel »

Yeah,

I do remove trailing spaces at the end.

I considered top-left point as (0, 0) to the right x increases and to the bottom y increases.

Suppose a turtle is at (5,3) then a SE command will move it to (6,4), right... ( provided the latter coordianate is valid ).

Another thing: if there are 10 rows and only row 1 and 2 contains turtle, then do you print 2 rows or 10 rows.

One last thing : Can there be invalid inputs.
little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm

Post by little joey »

What I meant is, that the dimensions are given in the order "height width", so if the input says "10 3", the lower left point is (2,9) and not (9,2).

I always print all rows, even when they are empty.

I don't take special measures to avoid wrong input, so I suppose it's ok.
sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Post by sohel »

LJ wrote: What I meant is, that the dimensions are given in the order "height width", so if the input says "10 3", the lower left point is (2,9) and not (9,2).
Shouldn't the lower left point be ( 0, 9 ) -- considering first parameter as x and the second as y... :-?
little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm

Post by little joey »

Sorry, got left and right mixed up :oops: :oops: :oops:
(2,9) is the lower right point
So for 10 3 (10 rows, 3 cols):
(0,0) upper left
(2,0) upper right
(0,9) lower left
(2,9) lower right
(Hope I got it right this time).
sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

yeaaaahh...

Post by sohel »

Finally got AC. 8)

The problem was, in the judge's input.. there were cases where two turtles have the same id. In that case, you have to process the very last one when a command is given on that id..
.. but about the other turtles with the same id, they do occupy a position.
Just assume that these turtles are there with a different id and no command will be imposed on them.

So strictly speaking, the judge's input is wrong as the problem statement does not clarify about this matter.
dontcry
New poster
Posts: 5
Joined: Sun Aug 06, 2006 9:55 pm

10156 --> Still getting WA!

Post by dontcry »

No trailing spaces, blank line after every single case (even the last one). I'm doing all that already.

For turtles with the same id I'm only considerating the last one given, even though the first ones occupy a position on the grid, and therefore appear as turtles on the solution as well.

Am i missing anything? I'm still getting WA!!

Thank you so much
Post Reply

Return to “Volume 101 (10100-10199)”