sweep line algorithm in dumb way