시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB64515911629.517%

문제

상근이는 좌표 평면 위의 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

예제 입력 2

5
-5 3 0
-5 -3 -30
0 1 0
3 7 35
1 -2 -1

예제 출력 2

10
W3sicHJvYmxlbV9pZCI6Ijk5MzciLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM5YzFcdWMxMjBcdWM3M2NcdWI4NWMgXHViOWNjXHViNGRjXHViMjk0IFx1YzBiY1x1YWMwMVx1ZDYxNSIsImRlc2NyaXB0aW9uIjoiPHA+XHVjMGMxXHVhZGZjXHVjNzc0XHViMjk0IFx1Yzg4Y1x1ZDQ1YyBcdWQzYzlcdWJhNzQgXHVjNzA0XHVjNzU4IEE8c3ViPmk8XC9zdWI+eCArIEI8c3ViPmk8XC9zdWI+eSArIEM8c3ViPmk8XC9zdWI+ID0gMCBcdWI4NWMgXHViMDk4XHVkMGMwXHViMGJjIFx1YzIxOCBcdWM3ODhcdWIyOTQgXHVjOWMxXHVjMTIwIE5cdWFjMWNcdWI5N2MgXHVhYzAwXHVjOWMwXHVhY2UwIFx1Yzc4OFx1YjJlNC48XC9wPlxyXG5cclxuPHA+XHVjMGMxXHVhZGZjXHVjNzc0XHVhYzAwIFx1YW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c3ViPmk8XC9zdWI+LCB0aGUgbnVtYmVycyBkZWZpbmluZyB0aGUgaTxzdXA+dGg8XC9zdXA+IGxpbmUuIEFsbCBudW1iZXJzIHdpbGwgYmUgbGVzc2VyIHRoYW4gMTA8c3VwPjk8XC9zdXA+LiZuYnNwOzxcL3A+XHJcbiIsIm91dHB1dCI6IjxwPlRoZSBmaXJzdCBhbmQgb25seSBsaW5lIG9mIG91dHB1dCBtdXN0IGNvbnNpc3Qgb2YgdGhlIHJlcXVpcmVkIG51bWJlciBmcm9tIHRoZSB0YXNrLiZuYnNwOzxcL3A+XHJcbiIsImhpbnQiOiI8cD5DbGFyaWZpY2F0aW9uIG9mIHRoZSBmaXJzdCBleGFtcGxlOiBUaGUgZXhhbXBsZSBjb3JyZXNwb25kcyB0byB0aGUgaW1hZ2UgaW4gdGhlIHRhc2suPFwvcD5cclxuIiwib3JpZ2luYWwiOiIxIiwiaHRtbF90aXRsZSI6IjAiLCJwcm9ibGVtX2xhbmdfdGNvZGUiOiJFbmdsaXNoIn1d

출처

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

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