시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 334 84 70 28.000%

문제

상근이는 좌표 평면 위의 Aix + Biy + Ci = 0 로 나타낼 수 있는 직선 N개를 가지고 있다.

상근이가 가지고 있는 직선으로 만들어지는 삼각형의 개수를 구하는 프로그램을 작성하시오.

세 직선이 한 점에서 만나는 경우는 없다.

입력

첫째 줄에 직선의 개수 N이 주어진다. (1 ≤ N ≤ 300,000)

다음 N개 줄에는 i번째 직선의 Ai, Bi, Ci가 주어진다. 모든 숫자는 절댓값이 109보다 작거나 같은 정수이다.

출력

첫째 줄에 입력으로 주어진 직선이 만드는 삼각형의 개수를 출력한다. 개수가 매우 많을 수 있기 때문에, 1,000,000,007로 나눈 나머지를 출력한다.

예제 입력 1

6
0 1 0
-5 3 0
-5 -2 25
0 1 -3
0 1 -2
-4 -5 29

예제 출력 1

10
W3sicHJvYmxlbV9pZCI6Ijk5MzciLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM5YzFcdWMxMjBcdWM3M2NcdWI4NWMgXHViOWNjXHViNGRjXHViMjk0IFx1YzBiY1x1YWMwMVx1ZDYxNSIsImRlc2NyaXB0aW9uIjoiPHA+XHVjMGMxXHVhZGZjXHVjNzc0XHViMjk0IFx1Yzg4Y1x1ZDQ1YyBcdWQzYzlcdWJhNzQgXHVjNzA0XHVjNzU4IEE8c3ViPmk8XC9zdWI+eCArIEI8c3ViPmk8XC9zdWI+eSArIEM8c3ViPmk8XC9zdWI+ID0gMCBcdWI4NWMgXHViMDk4XHVkMGMwXHViMGJjIFx1YzIxOCBcdWM3ODhcdWIyOTQgXHVjOWMxXHVjMTIwIE5cdWFjMWNcdWI5N2MgXHVhYzAwXHVjOWMwXHVhY2UwIFx1Yzc4OFx1YjJlNC48XC9wPlxyXG5cclxuPHA+XHVjMGMxXHVhZGZjXHVjNzc0XHVhYzAwIFx1YWMwMFx1YzljMFx1YWNlMCBcdWM3ODhcdWIyOTQgXHVjOWMxXHV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JzcDs8XC9wPlxyXG4iLCJvcmlnaW5hbCI6IjEiLCJwcm9ibGVtX2xhbmdfY29kZSI6Ilx1YzYwMVx1YzViNCJ9XQ==

출처

Contest > Croatian Open Competition in Informatics > COCI 2013/2014 > Contest #5 5번

  • 문제를 번역한 사람: baekjoon
  • 문제의 오타를 찾은 사람: cheetose