Page 1 of 4

10589 - Area

Posted: Sat Dec 27, 2003 9:53 pm
by Dreamer#1
This is a pretty straight forward problem but I can't understand why do I keep geting WA. Nothing much to think about either. Precision shouldn't be a headache here becuase long double can be as precise as 10e-17. Thus achieving a precision of 10e-5/7 shouldn't take any trouble at all. I have a feeling that there is something wrong in the judge input/output. The problemsetter need to recheck everything. If the problemsetter was wanting us to use string based floating number arithmetic to meet the precision requirements of this problem then he has certainly mistaken. This problem clearly doesn't ask for that. Please rethink on this point. One more thing, the problem description doesn't say the precision or number of digits after decimal of "a" in the the input. If there is any trick in that then that is certainly not fair. Not specifying this little things is ok but in case input set has value of "a" with very high precision then thats no trick. Thats cheating.

The problemsetter should review the problem. That should atleast make him correct the one mistake that is clearly visible on the problem description. The formula given there should be A = (M*a*a/N) [a instead of b].

It is really annoying when such easy problems don't get AC for no reason at all.

Hope others agree with me.
I'm sorry if I've been a little rude but you know how it feels.

Dreamer

Posted: Sat Dec 27, 2003 10:47 pm
by Larry
Try using long long's.. read the problem carefully..

Posted: Sun Dec 28, 2003 12:00 am
by Dreamer#1
Try using long long's.. read the problem carefully..
I can't find any reason to use long long :( . Long double is the only thing required here. Don't forget, 0<=M<=N<10e6, 10<=a<100.
Thus, using A = (M*a*a/N), 0<=A<10000

Am I right?

Thanks for your reply. :)

Dreamer

hmm

Posted: Sun Dec 28, 2003 2:22 am
by shahriar_manzoor
The judge data may still have some mistake. Let me check. Don't try it now.

AC..

Posted: Sun Dec 28, 2003 4:14 pm
by CelebiX
I have just tried this 0.0%-rated problem and got accepted in a few trials.
The key is high precision - simply using double or long double may not be sufficient.
Try to "magnify" the input numbers.

Re: AC..

Posted: Mon Dec 29, 2003 5:01 am
by rotoZOOM
CelebiX wrote:I have just tried this 0.0%-rated problem and got accepted in a few trials.
The key is high precision - simply using double or long double may not be sufficient.
Try to "magnify" the input numbers.
I have tried long long for input data (fscanf (in,"%lf",&a); b=a*10000000;}
But I my solution still WA :((

Re: AC..

Posted: Mon Dec 29, 2003 5:38 am
by shahriar_manzoor
rotoZOOM wrote:
CelebiX wrote:I have just tried this 0.0%-rated problem and got accepted in a few trials.
The key is high precision - simply using double or long double may not be sufficient.
Try to "magnify" the input numbers.
I have tried long long for input data (fscanf (in,"%lf",&a); b=a*10000000;}
But I my solution still WA :((
Mail me your code at shahriar@neksus.com

Posted: Mon Dec 29, 2003 7:15 pm
by Adrian Kuegel
I think it means that the only numbers for n that are used in the input are 1, 10, 100, 1000, 10000 and 100000 (and I verified that by inserting an endless loop if n is not one of these). Because of this the output number can always be exactly written with 5 digits after the decimal point (no rounding necessary, and I avoided the usage of double entirely).
And I also read the input by ignoring the '.', that is exactly as if I would multiply each number by 10000000. Anyway, I didn't got Accepted so far.

Posted: Tue Dec 30, 2003 5:24 am
by rotoZOOM
Adrian Kuegel wrote:I think it means that the only numbers for n that are used in the input are 1, 10, 100, 1000, 10000 and 100000 (and I verified that by inserting an endless loop if n is not one of these). Because of this the output number can always be exactly written with 5 digits after the decimal point (no rounding necessary, and I avoided the usage of double entirely).
And I also read the input by ignoring the '.', that is exactly as if I would multiply each number by 10000000. Anyway, I didn't got Accepted so far.
I got AC.
I did the same as you wrote.
First I use long long for ALL calculation.
Second, I read input coordinates like you (ignore point) (long long).
Third, I do
sprintf (t,"%lld.%lld",res/n,res%n)
then just add '0' unless there are 5 digits after decimal point.
And don't forget about 'Each output on separate line'

Posted: Tue Dec 30, 2003 8:35 am
by ..
Shahriar Manzoor, could you please check if the input/output is correct?
I have got AC, but I find that my code is actually wrong for some case.

At first I keep getting WA by this:

Code: Select all

sprintf (t,"%d",res);
// and then I will use memmove to shift some bytes by one byte later and add the ''.'
After I used this method, I got AC.

Code: Select all

sprintf (t,"%lld.%lld",res/n,res%n)
But I find that,
for the case, a = 10, 59049 out of 100000 points in the region,
My AC code gives the output 59.49000(wrong), but my WA code gives the output 59.049(correct). I wonder if there is such case in the input/output.

Anyway, Adrian do you use this?

Code: Select all

sprintf (t,"%lld.%lld",res/n,res%n)
If no, please try to see if this helps you AC.

Posted: Tue Dec 30, 2003 4:32 pm
by tat tvam asi
helo

just another example
100 11
5.5 5.5 /* 5x */
0.0 0.0 /* 95x */

5*121/100=6.05 != 6.5.
if 0 < ( res % n ) < ( n / 10 )
the above sprintf doesn't work.

helo
tat tvam asi

hello

Posted: Tue Dec 30, 2003 4:42 pm
by shahriar_manzoor
Mr. .. :)

Send me your both codes right and wrong.

I made a mistake, thought i corrected it just to make another mistake. Want to make sure this time it is right :)

-Shahriar

Posted: Tue Dec 30, 2003 4:50 pm
by Adrian Kuegel
Anyway, Adrian do you use this?
Code:
sprintf (t,"%lld.%lld",res/n,res%n)
If no, please try to see if this helps you AC.
Now I used this, and got Accepted. The judge output is definitely wrong.

Posted: Mon Jan 05, 2004 9:07 am
by Andrey Mokhov
Hello, everyone!

Is the problem correct now or not? I dont want to send wrong code... It's enough rejudgements without my fault :D

Andrey.

Posted: Mon Jan 12, 2004 8:39 am
by hujialie
Ask again:

Is the problem OK now?
Have the wrong data been fixed
and previous solutions rejudged?
Can we start submitting now?