Test #2
What's wrong with this test?
Re: Test #2
Послано
Ronnie 30 апр 2011 21:13
i have the same question. what's the catch?
and what's with the "ambiguous" case? how can it be ambiguous?
Re: Test #2
When tank angled too much, one or more of sensors will show 0.
If 3 or 2 neighboring sensors shows 0, then you cant determine the angle, but at whole data is not erroneous, so you shall output "ambiguous"
for exampe
10 0 1 1 0 - ambiguous
10 0 1 0 1 - error
10 0 0 0 0 - 0.0
10 0 1 3 1 - 104.166667 (not error!)
10 0 1 3 2 - 150.0
10 0 1 5 3 - 202.083333
10 0 1 3 5 - error
Edited by author 01.05.2011 03:36
Re: Test #2
OMG, my program passed all these tests, but still WA#2. Do you have any other tricky tests?
Re: Test #2
I don't know ;)
naive o^2 * (h1 + h2 + h3 + h4) / 4 will pass test #2 (with checking erroneous data preliminarily of course) and will WA only at #3
try swap data, like this:
10 0 1 3 2
10 2 0 1 3
10 3 2 0 1
10 1 3 2 0
etc.
Edited by author 01.05.2011 02:41
Re: Test #2
Of course, I considered this case. Now I have WA#4. This test helped me a little:
1000000 1000000 1000000 1000000 1000000 -> 1000000000000000000.000
I guess, there are exists such tests, where, while calculating the volume, the itermediate calculations exceed 2^64. The reason of WA seems to be this.
P.S. Don't like Java :)
Re: Test #2
bsu.mmf.team, did you find the mistake? What is it?
Edited by author 05.05.2011 16:26
Re: Test #2
I've used extended (in Pascal) to perform all calculations. But I think precision of double also enough to perform it, because required "relative error of at most 10^6".
I hope you're not using integers of any size to perform real-number calculations? ;)
---
I've just sent my solution replacing extended to double - it still have AC.
But when I replaced it again to single (Pascal) - I got WA #4.
So, if you using float (in Java) you have to replace it with double
Edited by author 05.05.2011 18:40
Re: Test #2
Yes, I found my mistake. I got AC after I changed my function, which checks if 4 points lie on the same plane. I rewrote it using only integer calculations.
Re: Test #2
what the wrong with test case 2 ,passing all of the forum :(.help pls..!!
Re: Test #2
Послано
svr 25 окт 2011 10:45
Friend! Your swapping-advice very right but very very dangerous!
My ideal AC program had 12 lost submissions due bad swapping.
Example: 0 1 3 2 -> 3 1 0 2- good.
1 0 3 2 -> 1 3 0 2 - bad! But double swapping swap(y2,y3),swap(y1,y4)
1 0 3 2 ->2 3 0 1 - right again!
P.S.
Why 1 0 3 2 -> 1 3 0 2 - bad? In 1,0,3,2 we have ciclic 3>2>1>0
but in 1,3,0,2 this invariant killed ,nature of data changed.
Edited by author 25.10.2011 11:07
Re: Test #2
This is what helped me pass WA #2:
Input:
1
10 0 1 4 1
Output:
114.814815