Page 1 of 1

10792 - The Laurel-Hardy Story

Posted: Sun Dec 12, 2004 10:56 pm
by Antonio Ocampo
Hi

Please give some I/O. I don't know why I got WA :( . I guess my formula is OK. :evil:

Thx in advance :D

Posted: Mon Dec 13, 2004 2:44 am
by Antonio Ocampo
Someone can confirm this ouput??

Input:

[cpp]
10
10 10 10
13 12 9
5 5 5
100 100 100
100 99 50
100 50 32
20 10 5
10 5 5
34 21 10
11 8 5
[/cpp]

Output

[cpp]
Case 1: 10.0000
Case 2: 15.0553
Case 3: 5.0000
Case 4: 100.0000
Case 5: 148.2580
Case 6: 70.5020
Case 7: 16.0436
Case 8: 5.0000
Case 9: 33.9655
Case 10: 11.2692
[/cpp]

Thx in advance :wink:

Posted: Mon Dec 13, 2004 2:49 am
by Adrian Kuegel
Your output is correct.
Maybe try:
1
100 5 5

Output should be:
Case 1: 5.0000

This was the test case I got wrong first (I did use binary search, and my ranges were wrong).

Posted: Mon Dec 13, 2004 6:55 am
by shamim
Adrian Kuegel wrote: This was the test case I got wrong first (I did use binary search, and my ranges were wrong).
Why do you need to use Binary Search, the answer is simply of the form:

ans = Expression();
where expression is a formula relating r,d and h. Binary search would be erroneous to implement.

Posted: Mon Dec 13, 2004 7:00 am
by Antonio Ocampo
By the way, why d>=5 and h1>=5. :oops:

Posted: Mon Dec 13, 2004 7:05 am
by Antonio Ocampo
Adrian, one more time, my input is correct. I don't know why I got WA.

Input

[cpp]
10
100 5 5
10 6 5
9 7 5
100 100 10
100 90 50
100 40 30
10 10 5
50 20 15
31 26 11
12 9 7
[/cpp]

Output

[cpp]
Case 1: 5.0000
Case 2: 7.0502
Case 3: 9.1113
Case 4: 190.0000
Case 5: 131.7663
Case 6: 51.0423
Case 7: 15.0000
Case 8: 25.5211
Case 9: 42.4190
Case 10: 11.0938
[/cpp]


Please give me more inputs/ouputs. Thanks :)

Posted: Mon Dec 13, 2004 7:08 am
by Adrian Kuegel
shamim wrote:Why do you need to use Binary Search, the answer is simply of the form:

ans = Expression();
Well, I didn't find that formula, but a formula where I can use binary search. So during the contest, I thought it is better to implement that than losing more time to find a better formula.
Antonio: your output is correct again. Since it seems you didn't use binary search like me, I can't tell you any other tricky input (the one I gave was tricky for my program).

Posted: Mon Dec 13, 2004 5:24 pm
by Antonio Ocampo
At last, I got AC !!!! :D . I Just changed this piece of my code:

[cpp]
printf("Case %i: %.4lf\n",caso,(-n-sqrt(q))/(2.0*m));
[/cpp]

by this

[cpp]
if( q<=0.0 )
q=-q;

printf("Case %i: %.4lf\n",caso,(-n-sqrt(q))/(2.0*m));
[/cpp]


Thanks to shamim and Adrian, bye.

Posted: Wed Dec 29, 2004 2:51 pm
by Experimenter
anyway,I've got accepted, though the problem states I should round UP, the number which means as far as I understand, I should round like ceil function does where as I just cut off everything after 4th digit and the problem is accepted.
i.e. I should output like this
printf("Case %d: %.4lf",i,FindH()+0.00005);
not just cutting the rest off:
printf("Case %d: %.4lf",i,FindH());

and the other bizarre thing is that it says that I should produce one line for each input line.
if I output like this every time
printf("Case %d: %.4lf\n",i,FindH());
everything is Ok. but the last line should be without \n, otherwise I would produce one extra line and there should be exact the same number in output as in input accorind to the problem.
If I do like I said, I'm getting PE. what a bizarre thing? :-?

Posted: Wed Dec 29, 2004 3:45 pm
by Experimenter
by the way, I tried to use binary search first:

Code: Select all

	double fia=0,fib = pi/2.0 - atan2(r-d,r),fic,Hc;
	while(fib - fia > eps)
	{
		fic = (fib + fia)/2.0;
		Hc = H(fic);
		if(Hc < h1)	fib = fic;
		else		fia = fic;
	}
	return l*sin(fia) + h1;
I cannot think why it gives wrong answer.

Posted: Tue Jan 04, 2005 12:26 pm
by misof
Experimenter wrote:anyway,I've got accepted, though the problem states I should round UP
Sadly, this is just a silly problem with the problemsetter's English. I already encountered this phrase several times (sadly, including one ACM ICPC regionals). By saying "round up the result" the problemsetter usually means "the result should be rounded" and this (again, usually) means "round the result using standard output routines".

Dear fellow problemsetters! Please don't use the phrase "round up", as it is confusing. Also, try to be as specific as possible when the output is a real number. It is usually a good idea to write a special judge for such tasks and to allow a small deviation from the correct output.

hmm

Posted: Tue Jan 04, 2005 2:10 pm
by shahriar_manzoor
For online contest special judges are good but in real time contest special judge is often not preferred. So when a contest is both online and realtime we try to avoid special judge.

The way that is employed is with the judge's solution a output file is generated. a small value EPS is added and then again a judge output is prepared. Then again this small EPS value is subtracted and another judge output is prepared. If all these output files are same then no special judge is required. The inputs which causes the three output files to be different are omitted from the judge data.

But for this problem I made a mistake... I never thought that people will use binary search for this problem. Because when u use binary search precision error becomes a bigger problem than it is for an analytical solution.

About rounding upto, I had a post earlier. I don't know but if a problem setter is really looking for ceiling he should precisely explain that. And a regional problemset is reviewed by 4/5 people and it is surprising that no one had any complains. I hope I remember this strange complain in future.

Posted: Tue Jan 04, 2005 7:44 pm
by Experimenter
dear shahriar_manzoor, thanks for answering to this topic and thanks taking into account my sort of complains, though I don't think the complain is strange as you say. :-)
I just looked in the dictionary to see whether I understand eveything correctly and there it is! so don't be too mad with my complain. :-D