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 1638. Bookworm

Bahturin Alexander (SibSUTI) Description of the mistake in the format of the sample input [10] // Problem 1638. Bookworm 11 Oct 2008 13:40
The correct format of the input is:
<width of the book w/o the cover>
<width of the cover>
<number of the book where the worm _finishes_>
<number of the book where the worm _starts_>

(so, the last two were just given in the incorrect order)
I disagree. Order of input data is absolutely correct.
Bahturin Alexander (SibSUTI) Re: Description of the mistake in the format of the sample input [7] // Problem 1638. Bookworm 11 Oct 2008 16:30
So whould you mind explaining me the 'Sample output'?
I treated the input as I wrote above and got AC..
I did as he told and got AC, too.
Vedernikoff Sergey (HSE: EconomicsForever!) Re: Description of the mistake in the format of the sample input [5] // Problem 1638. Bookworm 11 Oct 2008 18:14
You are wrong, guys. Input format is correct. You're lucky that ACed the problem without thinking about it. Think - and you'll find out that input specification is indeed correct - it's a very famous logical puzzle =)
Anisimov Dmitry (Novosibirsk STU) Re: Description of the mistake in the format of the sample input [4] // Problem 1638. Bookworm 12 Oct 2008 20:11
The input format is entirely correct.
The problem requires knowledge about how REAL books are USUALLY placed on shelves.
The problem is very old trick really. I am sure many of contestants were already familiar with it (I was).

Edited by author 12.10.2008 20:12

Edited by author 12.10.2008 20:12
Bahturin Alexander (SibSUTI) Re: Description of the mistake in the format of the sample input [1] // Problem 1638. Bookworm 14 Oct 2008 00:26
So.. Do you (all of you who says that input format is correct) mean that books are stored in a way that the last page is the leftmost one? If so than it's not surprising that the solution which swaps numbers of the books gets AC.
yes, just imagine.
when you place books on the shelf, the books are facing inwards, which means, the first page is on the right and the last page is on the left.
Hah, I wasn't familiar with this particular trick, but I've done enough of the "simple" problems on Timus now to know that many problems derive their difficulty not from the underlying algorithm, but in correctly understanding problem statements which are sometimes tricky, ambiguous, or rely on unstated assumptions (like this one, assuming how people "normally" put books on shelves, and which side of the book contains the first page).

So I'm learning to always ask "what's the catch?" and got AC first time on this one (after initial WA on many other "simple" problems).   So solving Timus problems is successfully training me to read problems very carefully!
If you are really smart, try the problems not one get AC before, otherwise get the hell out of your pretentious mask.