tom's blog

By tom, 10 years ago, In English

Hello guys,

2 days ago we've got Qualification on my University to National Championship Contest. And we had to face this problem:

Count all squares made by lines which are given by 2 points on input.

My solution: Store the map < pair<Line, distance between 2 collinear lines>, number of such pairs of lines> and for each pair of collinear lines (let's name one of them l) count distance between them and p = perpendicular line and add to the result map[p]*map[l]

But I'm getting WA for few hours.

My code: http://ideone.com/2ZhOzJ

Can anybody point me an error?

  • Vote: I like it
  • 0
  • Vote: I do not like it