10215 - The Largest/Smallest Box ...

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

Moderator: Board moderators

nukeu666
New poster
Posts: 44
Joined: Sun Feb 13, 2005 1:13 am
Location: India
Contact:

Post by nukeu666 » Wed Nov 30, 2005 10:09 pm

bleh...finally got it accepted
the program works only with double
float gives the 3rd decimal place rounding off error
does this tell us double is more accurate than float? (even when talking about the 3rd decimal point?)
google

mamun
A great helper
Posts: 286
Joined: Mon Oct 03, 2005 1:54 pm
Location: Bangladesh
Contact:

Post by mamun » Wed Nov 30, 2005 10:58 pm

nukeu666 wrote:does this tell us double is more accurate than float? (even when talking about the 3rd decimal point?)
That is how it is. Nowhere I've used float but double.

ayon
Experienced poster
Posts: 161
Joined: Tue Oct 25, 2005 8:38 pm
Location: buet, dhaka, bangladesh

Post by ayon » Sun Dec 25, 2005 10:51 am

i still cannot understand the problem. from observation V=(W-2x)(L-2x)x. for V(max), x has only one value, it has no trouble. but for V(min), x = 0, W/2, L/2; so to determine V(min), i printed 3 values of x, while W != L, and 2 values of x, while W = L, and i got WA. then i checked the board and found that, the program is accepted only for 2 values of x; x = 0 and x = min(W,L)/2. but why not x = 0, min(W,L)/2 and max(W,L)/2, while W != L ?
ishtiak zaman
----------------
the world is nothing but a good program, and we are all some instances of the program

mamun
A great helper
Posts: 286
Joined: Mon Oct 03, 2005 1:54 pm
Location: Bangladesh
Contact:

Post by mamun » Sun Dec 25, 2005 11:45 am

Instead of telling min() or max(), let's consider L>W. Other than 0, W/2 is one answer, you understand. But if you cut L/2 along L axis do you get enough length along W axis to cut the same amount?

ayon
Experienced poster
Posts: 161
Joined: Tue Oct 25, 2005 8:38 pm
Location: buet, dhaka, bangladesh

Post by ayon » Sun Dec 25, 2005 5:29 pm

i understand, thanks mamun. actually i was treating the problem only with the equation, not with its original visual body.
ishtiak zaman
----------------
the world is nothing but a good program, and we are all some instances of the program

DIR EN GREY
New poster
Posts: 12
Joined: Thu Nov 09, 2006 11:49 am

Rejudge

Post by DIR EN GREY » Mon Nov 27, 2006 8:27 pm

Rejudgement makes this problem very very difficult one. Now, accept rate is only 2.0%, of cource I got WA too :-(

http://acm.uva.es/p/problemstat.php?p=:10215

I checked the board, however, judges have just delete some tricky inputs.

http://online-judge.uva.es/board/viewtopic.php?t=12778

Why everybody got wa? I think if judges only delete inputs, programs which got accept first time should be accepted. So there must be some brandnew inputs.

Help! I need somebody, not just anybody but have got accept this time.

Here is my code.

Code: Select all

cut after got ac
Thanks in advance :D
Last edited by DIR EN GREY on Tue Nov 28, 2006 12:15 am, edited 1 time in total.
Do you understand my English???

Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan » Mon Nov 27, 2006 9:17 pm

Add eps before printing anything. I used 1e-7. Hope it helps.
Ami ekhono shopno dekhi...
HomePage

DIR EN GREY
New poster
Posts: 12
Joined: Thu Nov 09, 2006 11:49 am

Post by DIR EN GREY » Tue Nov 28, 2006 12:23 am

Jan wrote:Add eps before printing anything. I used 1e-7. Hope it helps.
Thanks Jan!! I got accept immediately, but I can't understand that why I must use eps before printing? How eps works? I always use cout, setiosflags() and setprecision() when round off is required, and they works fine without EPS...

What input is crtical?? When I should use EPS??

thanks in advance :P
Do you understand my English???

Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan » Tue Nov 28, 2006 2:13 am

Imagine that the output is 1.05, but due to floating point calculation, your output became 1.049999999999. Now if you print only one digit after the decimal point your output is 1.0 but the real output is actually 1.1.
Thats why almost all problems that have floating point output are judged with a special judge program (marked by a yellow flag). But some problems dont have the special judge, for those problems its better to add eps before printing any floating point number. And eps should be as small as possible. Using 1e-7 to 1e-11 is sufficient.

Code: Select all

double a;
a=0.15;
printf("%.1lf\n",a);
The output will show .1, which is obviously not correct. But if you add eps before printing 'a', you will see .2, which is the correct output.
Ami ekhono shopno dekhi...
HomePage

DIR EN GREY
New poster
Posts: 12
Joined: Thu Nov 09, 2006 11:49 am

Post by DIR EN GREY » Wed Nov 29, 2006 3:23 am

Thanks Jan!! I understand this issue now. I didn't know purpose of the yellow mark.

Allow me to again thank you :D
Do you understand my English???

fpavetic
Learning poster
Posts: 51
Joined: Sat Mar 04, 2006 8:00 pm

Post by fpavetic » Sun Dec 03, 2006 2:10 am

i got this problem accepted by storing intermediate calculations in long double, and printing the result as double after many failed submissions.

abhiramn
New poster
Posts: 29
Joined: Sat May 26, 2007 7:54 pm

PLEASE HELP!!!

Post by abhiramn » Thu Jun 21, 2007 3:07 pm

Code: Select all

CODE ACCEPTED!!!
Please tell me why this if giving WA :cry: :cry: :cry:
@Mr. Jan
max+=0.0000001 is that what you meant when you said add eps??? If not, please tell me what you meant. Thanks a lot.[[/b]

User avatar
WingletE
New poster
Posts: 35
Joined: Sun Aug 13, 2006 1:34 pm
Location: Taipei, Taiwan
Contact:

Post by WingletE » Mon Aug 20, 2007 6:58 am

:evil:
I got a lot of WA and finally got AC at once after changing COUT to printf...

User avatar
willima
New poster
Posts: 13
Joined: Wed Dec 07, 2005 1:19 pm
Location: Brazil

Confused

Post by willima » Mon Sep 10, 2007 7:18 pm

I really didn't undertand why your code print 3 numbers as output for some inputs. My WA code printed the following for the last 3 cases of the first post:

Code: Select all

1666.500 0.000 4999.500
0.250 0.000 0.500 4999.500
0.250 0.000 0.500 4999.500
If the minimum volume is 0 and the volume is (L-2x)(M-2x)x, I got:
- L - 2x = 0;
- M - 2x = 0;
- x = 0.

Where is my mistake?

Thanks,

Willian.
"Don't let the day go by
Don't let it end
Don't let the day go by, in doubts
The anwser lis within"

fR0D
New poster
Posts: 29
Joined: Mon Feb 11, 2008 5:59 am
Contact:

why is my programm giving WA

Post by fR0D » Sun Feb 24, 2008 6:30 am

here's my code....it seems right but gives WA...also suggest me how to use eps???

Code: Select all

CODE Deleted after AC
Last edited by fR0D on Mon Feb 25, 2008 8:09 pm, edited 1 time in total.

Post Reply

Return to “Volume 102 (10200-10299)”