| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 512 MB | 47 | 18 | 16 | 45.714% |
Last winter, an avalanche swept away all the ski lifts from the ski resort Valen. Instead of rebuilding the lifts like they were before, the plan is to do it in a more optimized way, and you are responsible for this.
The only thing remaining from the old lift system are n pylons situated at integer coordinates in the plane. You would like to put lifts in the form of line segments between some of these pylons. The line segments must satisfy the following constraints:
What is the maximum number of ski lifts (line segments) you can place under these constraints?
The first line contains one integer n (1 ≤ n ≤ 105). Each of the following n lines contains three integers x, y, and a, the coordinates and type of a pylon (0 ≤ x, y ≤ 105; a = 1 for a one-way pylon and a = 2 for a two-way pylon). All the pylons are situated at different coordinates.
Output the maximum number of ski lift line segments that can be placed.
8 1 0 1 3 0 2 0 1 1 2 1 2 4 1 2 1 2 2 2 3 1 4 3 1
4
4 0 0 1 100000 1 1 0 99999 1 100000 100000 1
2
Contest > KTH Challenge > KTH Challenge 2019 F번