## The Cosmic Era P4 - Freedom Appears!

View as PDF

Points: 7
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type

The Archangel is under attack and about to be destroyed! Luckily, Kira arrives in his ZGMF-X10A Freedom Gundam! He needs you to help him with the targeting of his beams! Kira and his Freedom Gundam is located at . There are enemy Mobile Suits numbered from that he needs to destroy. Each enemy is located at a position . We assume that the enemy Gundams are points, and none of the Gundams (including Kira) are located at the same position. The Freedom Gundam can only fire lasers along a straight path. But, as an upside, when Kira fires his laser beam, it will instantly destroy everything in its path.

Kira wants you to tell him the minimum number of times that he needs to fire his laser beam.

#### Input Specification

The first line will have 3 integers, , each separated by a space. The second line will have the integer . The next lines will each have 3 integers, the coordinates of an enemy mobile suit , each separated by a space.

#### Sample Input

0 0 0
3
1 1 0
2 2 0
-1 2 3

#### Output for Sample Input

2

#### Explanation of Output for Sample Input

, , and all lie on the same line, so he can destroy 2 enemies with 1 shot. And he needs 1 more shot to destroy the mobile suit that lies on .

## Comments

• commented on May 18, 2016, 2:21 a.m.

Does the Gundam only shoot in 1 direction at a time?

I.E. if there is one enemy in front of the Gundam and one right behind such that the Gundam and two enemies are collinear, it still takes 2 shots, right?

• commented on Sept. 25, 2018, 1:16 a.m.

yes