Log in

Waterloo contest - lars0 [entries|archive|friends|userinfo]

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Waterloo contest [Feb. 5th, 2005|04:39 pm]
I beat everybody today! :)

http://plg.uwaterloo.ca/cgi-bin/cgiwrap/acm00/score2.cgi (same contest)

It was nice to code at home, instead of on the broken terminals in MC. Problem A was on the nasty side. I was lucky to notice all the tricky cases, and also to come up with a nice approach. For a long while I thought I would have to do all kinds of horrible 3D geometry, but I ended up just doing a 4-point binary search (or whatever one wants to call it) on the line segment joining A and B. Segment AB happens to lie on the great circle - how convenient! So for every point P on it, you can just extend OP to the edge of the great arc.

From: kalmakka
2005-02-06 01:51 am (UTC)
Nice. I did the exact same thing. I only screwed up the rounding.
int lat = asin(stuff)*stuff + 0.5;
if (lat < 0){ more stuff }

Truncation makes very little sense, imnsho. Why can't computers use the floor function instead?
(Reply) (Thread)
[User Picture]From: dplass
2005-02-07 02:31 pm (UTC)
Props! I didn't even know there was a contest.
(Reply) (Thread)