Page 1 of 1

235 - Typesetting

Posted: Mon Jan 17, 2005 7:53 pm
by ..
I have some confustion about the problem statements.

1. Is the input terminated by a dataset of N = 0? Although it should be, it is not clearly written.

2. For each dataset, should we start the paragaph number from 1? Or should we count paragrach for the whole input file? Although it should be former one, it is not clearly written.

3. Under the problem definition, character may be scaled to use 0 unit width. Should we consider it as 1 unit?

4. It is said "The words in each paragraph are sequences of no more than 8 non-blank characters separated by spaces (that is, blanks - no tab characters will appear in the input). Spaces at the ends of input lines are irrelevant". If this is correct, then in sample input

Code: Select all

3 100
AAA
AAA BBB CCC
We should consider the first word as "AAAAAA" instead of "AAA".....
I hope this is only a minor mistake instead of a trap....

Posted: Tue Jan 18, 2005 11:02 am
by little joey
The testset for this problem is wrong. I meant to write about it, but somehow simply forgot...

To get accepted for this problem, you have to round up when calculating the actual width of a letter. Although that makes more sense for a real life typesetter, the problem description specifically states that you should round to the nearest integer. So the problemset, which was taken from the original contest data (I suppose), contains this error.

About your questions:
1. I guess so. My continuation condition is

Code: Select all

while((scanf("%d",&letters)==1)&&letters){
2. The first alternative.

3. I use actual_width = (width * size +9) / 10, which will always be >0. But as stated this is wrong. It should be actual_width = (width * size +5) / 10, which can be zero.

4. I consider a line break as word separator, so your sample contains 4 words. I agree with you that the description could be more specific in this case.

Posted: Tue Jan 18, 2005 11:32 am
by ..
Oh yes, the testdata is wrong now....
Thanks for the reply, otherwise I will waste much more time to find the non-existing bug.......

Posted: Fri Nov 24, 2006 2:36 pm
by rio
I m currently getting WA, but cant find any reason. Can anyone please verify the I/O set?

Input:

Code: Select all

5
A 10 20 30 12 22 32
B 1 2 3 4 5 6
C 9 10 8 3 5 2
D 2 4 5 6 7 11
  2 4 6 3 5 7
1 1
*f2 A *f2 B *s1 C *s2 D *s99 ABCD
4 100
AAA *f1 *f1 *f2 *s30
*f6 AAA BBB CCC *f3 *s25
ABC *f1 CBA AABC *f6 CACA D
*f4 AABBB B *s21 DAB
0 0
0
Outupt:

Code: Select all

Paragraph 1
Line 1: A (-19 whitespace)
Line 2: B (-1 whitespace)
Line 3: C ... C (0 whitespace)
Line 4: D ... D (0 whitespace)
Line 5: ABCD (-356 whitespace)
Paragraph 2
Line 1: AAA ... AAA (70 whitespace)
Line 2: AAA (-188 whitespace)
Line 3: BBB ... CCC (7 whitespace)
Line 4: ABC (-3 whitespace)
Line 5: CBA ... CBA (49 whitespace)
Line 6: AABC ... AABC (24 whitespace)
Line 7: CACA (-70 whitespace)
Line 8: D ... D (72 whitespace)
Line 9: AABBB ... AABBB (10 whitespace)
Line 10: B ... DAB (38 whitespace)

Posted: Fri Nov 24, 2006 6:04 pm
by ..
Hi,

Here is my output, I think it is the same as you.

Code: Select all

Paragraph 1
Line 1: A (-19 whitespace)
Line 2: B (-1 whitespace)
Line 3: C ... C (0 whitespace)
Line 4: D ... D (0 whitespace)
Line 5: ABCD (-356 whitespace)
Paragraph 2
Line 1: AAA ... AAA (70 whitespace)
Line 2: AAA (-188 whitespace)
Line 3: BBB ... CCC (7 whitespace)
Line 4: ABC (-3 whitespace)
Line 5: CBA ... CBA (49 whitespace)
Line 6: AABC ... AABC (24 whitespace)
Line 7: CACA (-70 whitespace)
Line 8: D ... D (72 whitespace)
Line 9: AABBB ... AABBB (10 whitespace)
Line 10: B ... DAB (36 whitespace)

Posted: Fri Nov 24, 2006 6:44 pm
by rio
Thank you for you reply.

The last line was different (my output is "38 whitespace").
It help me kill the bug and got AC.

Re: 235

Posted: Wed Mar 23, 2011 5:14 pm
by stencel
little joey wrote:3. I use actual_width = (width * size +9) / 10, which will always be >0. But as stated this is wrong. It should be actual_width = (width * size +5) / 10, which can be zero.
This remark is no longer valid. In order to get accepted you have to use the second formula which conforms to the problem statement.