|
|
Had problem with 25th test because of integer overflow. My program used int64_t which was not enough with my approach. Casting computations to double hepled me. If you have WA#8 then check that m >= h Thanks a lot. if m<h then writeln('NO'). What is trick? Use 64-bit integers to calculate coeffitients A, B, C, D of plane equation Ax + By + Cz + D = 0. Edited by author 25.06.2010 15:14 For people in the future - test 4 is the case of the sphere touching the floor. del Edited by author 06.12.2010 14:41 At some test can be overflow of int64 type. Edited by author 27.01.2011 07:01 It can be solved with integer-only arithmetic without divisions: sphere of radius r from D in tetrahedron ABCD touches ABC if sqr(v6(a,b,c,d)) <= sqr(r) * s4(a,b,c), where v6 is 6 times volume of the tetrahedron and s4 is 4 times area squared (all easily calculated with vector arithmetic), but you will get out of long long by this, so use v6(a,b,c,d) <= r * sqrt((double)s4(a,b,c)) instead. Edited by author 14.11.2010 19:21 Edited by author 14.11.2010 19:22 Xot kto nibud, skajite, chto takoe sluchaet test13 |
|
|