10589 - Area

All about problems in Volume 105. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Dreamer#1
Learning poster
Posts: 77
Joined: Tue Oct 07, 2003 10:07 pm

10589 - Area

Post 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
Last edited by Dreamer#1 on Sun Dec 28, 2003 12:03 am, edited 1 time in total.
Not all of our dreams can be made to come true. But still we live with the hope to turn them into reality someday.
Larry
Guru
Posts: 647
Joined: Wed Jun 26, 2002 10:12 pm
Location: Hong Kong and New York City
Contact:

Post by Larry »

Try using long long's.. read the problem carefully..
Dreamer#1
Learning poster
Posts: 77
Joined: Tue Oct 07, 2003 10:07 pm

Post 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
Not all of our dreams can be made to come true. But still we live with the hope to turn them into reality someday.
shahriar_manzoor
System administrator & Problemsetter
Posts: 399
Joined: Sat Jan 12, 2002 2:00 am

hmm

Post by shahriar_manzoor »

The judge data may still have some mistake. Let me check. Don't try it now.
CelebiX
New poster
Posts: 5
Joined: Tue Jun 18, 2002 11:05 am

AC..

Post 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.
rotoZOOM
Learning poster
Posts: 63
Joined: Mon Dec 22, 2003 5:05 am
Location: Russia, Chelyabinsk
Contact:

Re: AC..

Post 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 :((
shahriar_manzoor
System administrator & Problemsetter
Posts: 399
Joined: Sat Jan 12, 2002 2:00 am

Re: AC..

Post 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
Adrian Kuegel
Guru
Posts: 724
Joined: Wed Dec 19, 2001 2:00 am
Location: Germany

Post 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.
rotoZOOM
Learning poster
Posts: 63
Joined: Mon Dec 22, 2003 5:05 am
Location: Russia, Chelyabinsk
Contact:

Post 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'
..
A great helper
Posts: 454
Joined: Thu Oct 18, 2001 2:00 am
Location: Hong Kong

Post 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.
My signature:
  • Please make discussion about the algorithm BRFORE posting source code.
    We can learn much more in discussion than reading source code.
  • I HATE testing account.
  • Don't send me source code for debug.
tat tvam asi
New poster
Posts: 30
Joined: Sat Nov 30, 2002 1:04 pm

Post 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
shahriar_manzoor
System administrator & Problemsetter
Posts: 399
Joined: Sat Jan 12, 2002 2:00 am

hello

Post 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
Adrian Kuegel
Guru
Posts: 724
Joined: Wed Dec 19, 2001 2:00 am
Location: Germany

Post 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.
Andrey Mokhov
Experienced poster
Posts: 128
Joined: Fri Nov 15, 2002 7:45 am
Location: Kyrgyzstan

Post 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.
hujialie
New poster
Posts: 43
Joined: Thu Apr 17, 2003 10:24 am
Location: Shanghai,China

Post by hujialie »

Ask again:

Is the problem OK now?
Have the wrong data been fixed
and previous solutions rejudged?
Can we start submitting now?
Retired from SJTU Accelerator 2004
Post Reply

Return to “Volume 105 (10500-10599)”