Problem J
Target Practice
You are a newly designed and created robot. As a robot, you are excellent at shooting lasers: your lasers always go perfectly straight, go infinitely far, and are infinitely thin. To test you, the scientist who made you set out a number of targets for you to hit with your laser beam. The targets (point-like objects) are set up in a large, open room.
Unfortunately, you are running low on battery. You only have enough charge left to fire two shots. The targets are transparent, so you might be able to shoot multiple targets with your laser beam. In fact, you are able to hit an infinite number of targets with a single shot, as long as they are on a straight line. In addition, you can move anywhere before and between the two shots. Can you figure out if it is possible to hit all targets with at most two shots from your laser beams?
Input
The first line contains an integer $N$, satisfying $1 \leq N \leq 100\, 000$, the number of targets.
The following $N$ lines each contain two integers $X_ i$ and $Y_ i$, satisfying $-10^9 \leq X_ i,Y_ i \leq 10^9$. Each pair $(X_ i,Y_ i)$ specifies the coordinates of one of the $N$ targets. No two targets are placed at the same coordinates.
You may assume that height does not play a role in this problem.
Output
Output a single line containing a single word: “success” if it is possible to line up the two shots so that they hit all the targets, and “failure” if it is not.
Sample Input 1 | Sample Output 1 |
---|---|
6 -1 0 0 0 1 0 -1 1 0 2 1 1 |
failure |
Sample Input 2 | Sample Output 2 |
---|---|
6 1 1 3 5 0 -1 1 0 5 0 0 0 |
success |