ok, this problem seemed fairly easy, but I keep on getting WA. Would someone give me a hint about (if there are any) tricky cases? Is there something with the train numbers, for instance, can they be negative or zero? 'coz there is nothing else I can think about.... but then, i have no clue how to proceed... pls, hints, hints, hints!
thanx
10423 - Peter Takes a Tramway
Moderator: Board moderators
10423 - Peter Takes a Tramway
Dealing with failure is easy: Work hard to improve.
Success is also easy to handle: You've solved the wrong problem. Work hard to improve.
Success is also easy to handle: You've solved the wrong problem. Work hard to improve.
anupam, I got AC - it is a real frustrating problem! Once I had a physics teacher and noone ever could score 100% on his tests, 'coz he would trick us... for instance, if in class he gave us all data in meters, then he would change it to centimeter in the test or something like that... You just need to read the question and think which tram # it is asking for and which one are you prinitng...
Dealing with failure is easy: Work hard to improve.
Success is also easy to handle: You've solved the wrong problem. Work hard to improve.
Success is also easy to handle: You've solved the wrong problem. Work hard to improve.
-
- Guru
- Posts: 647
- Joined: Wed Jun 26, 2002 10:12 pm
- Location: Hong Kong and New York City
- Contact:
But there's no "trick" in this problem.. just tons of potential for boundary condition errors.. once again, just be careful how you implement it and it should be okay.
Here's what I used for test cases - it's easy to check them by hand:
And I get:
Here's what I used for test cases - it's easy to check them by hand:
Code: Select all
5
1: 58 -1
2: 59 -1
3: 0 -1
4: 1 -1
5: 2 -1
0 1000000
5
1: 58 -1
2: 59 -1
3: 0 -1
4: 1 -1
5: 2 -1
0 1000001
5
1: 58 -1
2: 59 -1
3: 0 -1
4: 1 -1
5: 2 -1
0 1000002
5
1: 58 -1
2: 59 -1
3: 0 -1
4: 1 -1
5: 2 -1
50 1000000
5
1: 58 -1
2: 59 -1
3: 0 -1
4: 1 -1
5: 2 -1
4 1000001
5
1: 58 -1
2: 59 -1
3: 0 -1
4: 1 -1
5: 2 -1
6 1000002
0
Code: Select all
Case 1: Peter arrives at stop 1000000 by tram 2.
Case 2: Peter arrives at stop 1000001 by tram 3.
Case 3: Peter arrives at stop 1000002 by tram 4.
Case 4: Peter arrives at stop 1000000 by tram 5.
Case 5: Peter arrives at stop 1000001 by tram 1.
Case 6: Peter arrives at stop 1000002 by tram 2.
-
- New poster
- Posts: 2
- Joined: Sun Feb 02, 2003 9:56 pm
- Location: Ukraine, Kyiv
- Contact:
One more thing...
Mind that in this problem you will get no P.E.. Well, maybe you can, but I forgot only to put a fullstop (".") at the end of every line, and the verdict was WA instead of PE.
-
- Guru
- Posts: 834
- Joined: Wed May 29, 2002 4:11 pm
- Location: Wroclaw, Poland
- Contact:
-
- Guru
- Posts: 1080
- Joined: Thu Dec 19, 2002 7:37 pm
Thanks Larry, I was suffering from the 'off by one' problem
but your test cases made me see it.
In Holland we have a saying:
but worse... 


In Holland we have a saying:
I must have bumped into the 'off by one' stone at least a million times (especially when doing modular arithmetic), which proves I'm not a donkeyA donkey never bumps into the same stone twice.

