ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1836. Babel Fish

Test #2
Posted by Vitaliy Karelin 30 Apr 2011 15:52
What's wrong with this test?
Re: Test #2
Posted by Ronnie 30 Apr 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
Posted by AterLux 1 May 2011 02:14
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
Posted by bsu.mmf.team 1 May 2011 02:33
OMG, my program passed all these tests, but still WA#2. Do you have any other tricky tests?
Re: Test #2
Posted by AterLux 1 May 2011 02:40
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
Posted by bsu.mmf.team 1 May 2011 03:03
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
Posted by sklyack 5 May 2011 16:25
bsu.mmf.team, did you find the mistake? What is it?

Edited by author 05.05.2011 16:26
Re: Test #2
Posted by AterLux 5 May 2011 18:36
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
Posted by bsu.mmf.team 6 May 2011 19:27
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
Posted by kaysar_buet08 30 Jun 2011 10:29
what the wrong with test case  2 ,passing all of the forum :(.help pls..!!
Re: Test #2
Posted by svr 25 Oct 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