171 - Car Trialling

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

Moderator: Board moderators

Pedrinho UFPE
New poster
Posts: 15
Joined: Tue Sep 10, 2002 1:56 am
Location: Brasil
Contact:

171 - Car Trialling

Post by Pedrinho UFPE » Thu Apr 17, 2003 5:49 am

This problem must be REALLY tricky.
I'm trying it for a long time, and I took an enormous test case of more then 500 tests.. and I still WA! Can somebody who had AC see what is my problem?

Code: Select all

... :) .. ok little joey, by your commands  


Thank you very much for any help!!

Pedro
Last edited by Pedrinho UFPE on Thu Apr 17, 2003 5:30 pm, edited 1 time in total.
Interested

User avatar
little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm

Post by little joey » Thu Apr 17, 2003 7:21 am

The input will be terminated by a line consisting of a single #.
Don't stop on input starting with #, only on input with one # on line by it self. Make this little adjustment and you'll get AC.

cheers,
-little joey

PS. Be so kind and remove the posted code, since it's a solution after a small modification.

Pedrinho UFPE
New poster
Posts: 15
Joined: Tue Sep 10, 2002 1:56 am
Location: Brasil
Contact:

Post by Pedrinho UFPE » Thu Apr 17, 2003 5:35 pm

I din't believe it.. how I'm stupid!!
Thank you little joey very much, I would never get by myself.
:)
Interested

Pntsk
New poster
Posts: 2
Joined: Thu Mar 02, 2006 2:13 pm

171 - Car Trialling - WA

Post by Pntsk » Thu Mar 02, 2006 3:00 pm

Hi, I try to explain (sorry for my english)...

I'm getting wrong answer,but I don't know why?

I have seen that:
There will be one or more spaces between items except before a period (.)
I don't know if it is "pre-condition" of problem.
I "filter" spaces if there are more than 1, but the period (.) can be out of speech marks, and it do two instructions for one line?? (I think no)

And if the line is only '\n', is ouput Trap or continue reading...

For example, one input for somebody have AC :
KEEP LEFT AND THEN GO RIGHT
GO LEFT AT " SMITH ST."

GO FIRST RIGHT AT "SMITH ST . " AND CAS TO 20 KMH
#
Thanks!!!

sds1100
Learning poster
Posts: 95
Joined: Sat Dec 10, 2005 2:09 pm

I don't know your program

Post by sds1100 » Fri Mar 03, 2006 8:23 am

I don't know your program

Pntsk
New poster
Posts: 2
Joined: Thu Mar 02, 2006 2:13 pm

I get AC!!!!!!!!!!!!!!!

Post by Pntsk » Fri Mar 03, 2006 10:19 pm

I get Accepted, sorry I missing one case:
>>> . . . "" . . . <<< of it is a trap output.

Thanks!!!

foolishzhu
New poster
Posts: 4
Joined: Sun Jul 02, 2006 5:00 am

Help acm171 WA needs more sample

Post by foolishzhu » Mon Sep 18, 2006 5:23 am

for one thing, can some give me more samples for it?

for anther, I forget my username and password. I only remember my user id 19394AL and contact email : xiumingzhu@gmail.com .How could I find my personal information?

yiuyuho
A great helper
Posts: 325
Joined: Thu Feb 21, 2002 2:00 am
Location: United States
Contact:

Post by yiuyuho » Mon Oct 09, 2006 8:36 am

Good catch Joey, Thanks! :D

DIR EN GREY
New poster
Posts: 12
Joined: Thu Nov 09, 2006 11:49 am

171 WA .... Why??

Post by DIR EN GREY » Thu Nov 09, 2006 12:00 pm

Hi.

I got many wrong answers... but I can't find where wrong in my code...
I attempted some inputs and all outputs are correct, mabe

please give some critical INPUT!!!! thanks.

Here is my code.

Code: Select all

got ac with a little change
Last edited by DIR EN GREY on Fri Nov 10, 2006 9:50 am, edited 1 time in total.
Do you understand my English???

DIR EN GREY
New poster
Posts: 12
Joined: Thu Nov 09, 2006 11:49 am

Post by DIR EN GREY » Fri Nov 10, 2006 9:49 am

nooooo!!! I found my mistake... I'm stupid... and get accept.

I got wa many times, and I made many test cases. I'll show that here, I wish these help someone...

last case is very critical data for my code... jesus...

INPUT:

Code: Select all

KEEP LEFT AND THEN GO RIGHT
CAS TO 20 KMH
GO FIRST       RIGHT AT "SMITH ST."  AND   CAS TO 20 KMH
CAS TO 1111111111111111 KMH
GO LEFT AT "SMITH STREET AND RECORD TIME."
GO FIRST RIGHT AND THEN GO FIRST RIGHT AND THEN GO FIRST RIGHT AND RECORD
RECORD TIME AND RECORD TIME
RECORD TIME GO LEFT
RECORD TIME GO
RECORD TIME G
KEEP FIRST LEFT
    KEEP LEFT  AND THEN GO THIRD  RIGHT AT "TEST." AND THEN  GO RIGHT AND CAS TO 0023 KMH
GO FIRST RIGHT AND THEN GO FIRST RIGHT AND THEN GO FIRST RIGHT AND RECORD TIME
GO FIRST RIGHT
GO FIRST RIGHT AND THEN GO FIRST RIGHT AND THEN GO FIRST RIGHT AND RECORD
RECORD TIME AND RECORD TIME
RECORD TIME GO LEFT
RECORD TIME GO
RECORD TIME G
KEEP FIRST LEFT
GO FIRST LEFT
GO SECOND LEFT
GO RIGHT
GO SECOND LEFT AT "BPI"
CAS TO 232 KMH
GO LEFT AT "TEST"
GO LEFT AT "D  T"
GO THIRD LEFT
KEEP RIGHT
KEEP LEFT
GO FIRST LEFT AT "AAA AND THEN GO FIRST LEFT AT AAA"
GO SECOND          RIGHT
GO       THIRD RIGHT
GO FIRST RIGHT AND THEN GO FIRST RIGHT AND THEN GO FIRST RIGHT
GO LEFT
GO LEFT AT "SMITH     STREET AND RECORD TIME."
KEEP RIGHT AND THEN RECORD TIME
GO 2nd RIGHT
GO           
GO LEFT AT "DT" RECORD TIME
CAS TO 1111111111111111 KMP
GO RIGHT FIRST
GO RIGHT SECOND
GO RIGHT THIRD
GO LEFT FIRST
GO LEFT SECOND
GO FIRST RIGHT AND THEN GO FIRST RIGHT AND THEN GO FIRST RIGHT AND RECORD
RECORD TIME AND RECORD TIME
RECORD TIME GO LEFT
RECORD TIME GO
RECORD TIME G
KEEP FIRST LEFT
GO FIRST LEFT AT "AAAp" AND THEN GO FIRST LEFT AT "AAA"
GO LEFT THIRD
GO LEFT   SECOND LEFT
GO LEFT SECOND  GO LEFT
GO LEFT SECOND KEEP LEFT
GO FIRST RIGHT AND THEN GO FIRST RIGHT AND THEN GO FIRST RIGHT AND THEN
GO FIRST RIGHT AND THEN GO FIRST RIGHT AND THEN KEEP FIRST RIGHT
GO FIRST LEFT LEFT AT "AAAp" AND THEN GO FIRST LEFT AT "AAA"
GO FIRST LEFT LEFT AT "AAAp" AND THEN GO FIRST LEFT AT "AAA"
GO FIRST LEFT AT "AAAp" AND THEN GO FIRST LEFT AT "AAA" RECORD TIME
##
"this is trap..."
GO LEFT AT "TE KDFD ...  ...  DFD"
GO LEFT AT "TE KDFD ...  ...  DFD "
GO LEFT AT   " TE KDFD ...  ...  DFD "
cas TO 232 KMH
GO            LEFT AT "TE KDFD ...  ...  DFD        ." AT "TEST"
GO LEFT AT "TE" AND AT "T"
GO FIRST RIGHT AND THEN GO FIRST RIGHT AND THEN KEEP LEFT
   RECORD   TIME
GO FIRST LEFT AT "AAA" AND THEN GO FIRST LEFT AT "AAA"
CHANGE AVERAGE SPEED TO 232 KMH
GORIGHT
GO
RECORD
CAS
go left

GO LEFT AT "test"
GO GO
LEFT
RIGHT
FIRST
AT "TEST."
AND RECORD TIME
RECORD TIME AND
34 2423342
CAS TO 34324 234 2342 34 KMH
CAS TO 34324KMH
PODF
GO FIRST RIGHT AND THEN GO FIRST RIGHT AND THEN GO FIRST RIGHT AND THEN
PDFF
    GO                            LEFT     
RIGHT
FIRST
AT "TEST."
AND RECORD TIME
RECORD TIME AND
34 2423342
GO RIGHT AT "TEST."
GO RIGHT AT "TEST. "
GO RIGHT AT "TEST ."
GO RIGHT AT " TEST."
GO RIGHT AT " TEST. "
GO RIGHT AT "TEST . "
GO RIGHT AT " TEST ."
GO RIGHT AT " TEST .  "
GO RIGHT AT "TEST."""
GO RIGHT AT " T ES T "
GO RIGHT AT " T Es T "
GO RIGHT AT " T 00 T "
GO RIGHT AT "TEST" AND THEN RECORD TIME
GO RIGHT AT "TEST" AND RECORD TIME AND THEN GO LEFT
GO RIGHT AT "TEST" AND RECORD TIME AND GO LEFT
GO RIGHT AT "TEST" AND RECORD TIME THEN GO LEFT
GO RIGHT AT "TEST" AND THEN RECORD TIME AND THEN GO LEFT
GO RIGHT AT "TEST" AND THEN GO RIGHT AT "TEST" "
GO RIGHT AT "TEST" AND THEN GO RIGHT AT "TEST" AND THEN GO LEFT AT ""
#
OUTPUT:

Code: Select all

  1. KEEP LEFT AND THEN GO RIGHT
  2. CAS TO 20 KMH
  3. GO FIRST RIGHT AT "SMITH ST." AND CAS TO 20 KMH
  4. CAS TO 1111111111111111 KMH
  5. GO LEFT AT "SMITH STREET AND RECORD TIME."
  6. Trap!
  7. Trap!
  8. Trap!
  9. Trap!
 10. Trap!
 11. Trap!
 12.  KEEP LEFT AND THEN GO THIRD RIGHT AT "TEST." AND THEN GO RIGHT AND CAS TO 0023 KMH
 13. GO FIRST RIGHT AND THEN GO FIRST RIGHT AND THEN GO FIRST RIGHT AND RECORD TIME
 14. GO FIRST RIGHT
 15. Trap!
 16. Trap!
 17. Trap!
 18. Trap!
 19. Trap!
 20. Trap!
 21. GO FIRST LEFT
 22. GO SECOND LEFT
 23. GO RIGHT
 24. GO SECOND LEFT AT "BPI"
 25. CAS TO 232 KMH
 26. GO LEFT AT "TEST"
 27. GO LEFT AT "D T"
 28. GO THIRD LEFT
 29. KEEP RIGHT
 30. KEEP LEFT
 31. GO FIRST LEFT AT "AAA AND THEN GO FIRST LEFT AT AAA"
 32. GO SECOND RIGHT
 33. GO THIRD RIGHT
 34. GO FIRST RIGHT AND THEN GO FIRST RIGHT AND THEN GO FIRST RIGHT
 35. GO LEFT
 36. GO LEFT AT "SMITH STREET AND RECORD TIME."
 37. Trap!
 38. Trap!
 39. Trap!
 40. Trap!
 41. Trap!
 42. Trap!
 43. Trap!
 44. Trap!
 45. Trap!
 46. Trap!
 47. Trap!
 48. Trap!
 49. Trap!
 50. Trap!
 51. Trap!
 52. Trap!
 53. Trap!
 54. Trap!
 55. Trap!
 56. Trap!
 57. Trap!
 58. Trap!
 59. Trap!
 60. Trap!
 61. Trap!
 62. Trap!
 63. Trap!
 64. Trap!
 65. Trap!
 66. Trap!
 67. Trap!
 68. Trap!
 69. Trap!
 70. Trap!
 71. GO FIRST RIGHT AND THEN GO FIRST RIGHT AND THEN KEEP LEFT
 72.  RECORD TIME
 73. GO FIRST LEFT AT "AAA" AND THEN GO FIRST LEFT AT "AAA"
 74. CHANGE AVERAGE SPEED TO 232 KMH
 75. Trap!
 76. Trap!
 77. Trap!
 78. Trap!
 79. Trap!
 80. Trap!
 81. Trap!
 82. Trap!
 83. Trap!
 84. Trap!
 85. Trap!
 86. Trap!
 87. Trap!
 88. Trap!
 89. Trap!
 90. Trap!
 91. Trap!
 92. Trap!
 93. Trap!
 94. Trap!
 95.  GO LEFT 
 96. Trap!
 97. Trap!
 98. Trap!
 99. Trap!
100. Trap!
101. Trap!
102. GO RIGHT AT "TEST."
103. Trap!
104. Trap!
105. Trap!
106. Trap!
107. Trap!
108. Trap!
109. Trap!
110. Trap!
111. Trap!
112. Trap!
113. Trap!
114. Trap!
115. Trap!
116. Trap!
117. Trap!
118. Trap!
119. Trap!
120. Trap!
good luck
Do you understand my English???

minskcity
Experienced poster
Posts: 199
Joined: Tue May 14, 2002 10:23 am
Location: Vancouver

Post by minskcity » Fri Dec 22, 2006 4:03 am

Could anybody decrypt the following sentence from the problem statement for me:
There will be one or more spaces between items except before a period (.), after the opening speech marks or before the closing speech marks.
Does it mean that input satisfies those conditions or does it mean that if input does not follow them, I should output "trap"?
Also, it's clear to me (from the sample input) that extra spaces are allowed between instructions. Are they allowed in side ""? Should I print a space in front/at the end of a line if input had space there?

yiuyuho
A great helper
Posts: 325
Joined: Thu Feb 21, 2002 2:00 am
Location: United States
Contact:

Post by yiuyuho » Fri Dec 22, 2006 5:24 am

Since this is a syntax parsing problem, I am guessing those are part of the problem. That is, if something don't satify the statement, you have to output trap.

Extra spaces are allowed inside " ", but if they are right after open or right before close " it's a trap.

If beginning or ending of an instruction has spaces its a trap.

That's how I interpret them anyways.
Hope it helps!

rickyliu
New poster
Posts: 30
Joined: Thu Sep 28, 2006 7:16 am

Post by rickyliu » Mon Jan 29, 2007 12:11 pm

yiuyuho wrote: If beginning or ending of an instruction has spaces its a trap.
I don't think it is a trap, at least my AC program doesn't count it.

Maybe just me, I don't understand why signwords can contain spaces. According to the question:
sign = "signwords"
signwords = s-word|signwords s-word
s-word = letter|s-word letter
letter = A..Z|.
letter can only be 'A'..'Z' or '.', right? If the sample input doesn't contain spaces, I am interested to know how many people can get AC. :wink:

S.H.Bouwhuis
New poster
Posts: 13
Joined: Fri Apr 27, 2007 12:03 pm
Location: The Netherlands

Re: 171 WA .... Why??

Post by S.H.Bouwhuis » Sun Apr 08, 2012 4:47 pm

Your sample inputs found some of the errors I made.

You, my dear friend, are a life-saver!
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.

MIGXEEEL
New poster
Posts: 6
Joined: Mon Jun 18, 2012 6:03 pm

171 Car Trialling

Post by MIGXEEEL » Sat Jun 23, 2012 1:31 pm

I need help with this problem, I know how can be resolved, but i don't know how to write it in a program.
My idea is doing it with a grammar and a backtracking parser, when the parser can't read the word then, it's Trap!, other way is the instruction.
Please, i'd aprecciate if someone that knows how to write a grammar and a parser, or someone that have resolved the problem could help me.
Besides there isn't code for this problem in this forum, so this could be helpful for everyone.

Post Reply

Return to “Volume 1 (100-199)”