ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1414. Astronomical Database

WA #1
Posted by Pavel Kovalenko 5 Nov 2010 00:43
I have WA #1. I checked following mistakes:
dots instead of spaces
sun in database
print 20 records
Also i cheсked following variants of actions:
Query "?" - print all records (or first 20) or print nothing.
Query "+" - add empty name into database or miss this query.
But any variant give me WA #1.
I use hash of all prefixes and store them in map.
Please help me. Simple problem, but there are some stupid bug. Offline my program passed all my tests.
My code:
http://pastebin.com/mtsVLZXB
Re: WA #1
Posted by Sergey Lazarev (MSU Tashkent) 6 Nov 2010 18:51
Your program gives incorrect answer to test:

+ea
+e
?e

You don't add a new star if it's name is the prefix of other star's name which was added earlier.
And I'm not sure, but it seems you forgot about lexicographical order.

Edited by author 06.11.2010 18:52
Re: WA #1
Posted by Pavel Kovalenko 6 Nov 2010 22:23
"You don't add a new star if it's name is the prefix of other star's name which was added earlier."

Thank you very much!