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 1469. No Smoking!

How to cheat and get AC.
Posted by Teacher30 (Burunduk1) 5 Apr 2013 17:19
Let project all segments to some line (x,y --> z=ax+by) and try all pairs of segments, which have an intersection of projections. To do it just sort events "open segment", "close segment" and brute force pairs.

You will get TL. Yet.

Now let try 4 lines: (a,b) = (1,0) (0,1) (1,1) (1,-1). At first, let estimate number of pairs to process for each line in O(nlogn) time. Now that we may choose line, which produces minimal mumber of pairs.

AC in 0.937 seconds. id = 4870936.