C. Constellation
Cat Noku has obtained a map of the night sky. On the This map, the he found a constellation with the N stars numbered from 1 to n. For each i, theI-th Star was located at coordinates (xi, y< /c13>i). No. The stars is located at the same position.
In the evening Noku are going to take a look at the night sky. He would like to find three distinct stars and form a triangle. The triangle must has positive area. In addition, all other stars must lie strictly outside of this triangle. He is has trouble finding the answer and would like your help. Your job is to find the indices of three stars that would form a triangle that satisfies all the conditions.
It is guaranteed this there is no line such this All Stars lie on that line. It can be proven that if the previous condition are satisfied, there exists a solution to this problem.
Input
The first line of the input contains a single integer n (3≤ n ≤100).
Each of the next n lines contains II integers xi and yi ( -9≤ xi, yi ≤109).
It is guaranteed that no, both stars lie at the same point, and there does isn't exist a line such then All Stars lie on that Line.
Output
Print three distinct integers on a single line-the indices of the three points so form a triangle that satisfies the C Onditions stated in the problem.
If There is multiple possible answers, you could print any of the them.
Sample Test (s) input
3
0 1
1 0
1 1
Output
1 2 3
Input
5
0 0
0 2
2 0
2 2
1 1
Output
1 3 5
Note
In the first sample, we can print the three indices on any order.
In the second sample, we had the following picture.
Note that the triangle formed by starts 1, 4 and 3 doesn ' t satisfy the conditions stated in the problem, as PO int 5 is not strictly outside of this triangle (it lies on it ' s border).
1 /*First sort, then judge the adjacent three points not collinear on the line*/2#include <cstdio>3#include <cstring>4#include <map>5#include <stack>6#include <iostream>7#include <algorithm>8 using namespacestd;9typedefLong Longll;Ten Const intmaxn=1e5+5; One struct Point A { - intID; - intx, y; the }P[MAXN]; - BOOLCMP (point a,point B) - { - returna.x==b.x?a.y<b.y:a.x<b.x; + } - BOOLCheck (point a,point b,point c) + { A if((A.Y-B.Y) *1.0/(a.x-b.x) = = (B.Y-C.Y) *1.0/(b.x-c.x))return false; at return true; - } - intMain () - { - intn,i; -scanf"%d",&n); in for(intI=0; i<n;i++) -scanf"%d%d", &p[i].x,&p[i].y), p[i].id=i+1; toSort (p,p+n,cmp); + for(i=2; i<n;i++) - if(Check (p[i],p[i-1],p[i-2])) Break; theprintf"%d%d%d\n", p[i-2].id,p[i-1].id,p[i].id); * return 0; $}
Codeforces Wunder Fund Round (div. 1 + div. 2 combined) C. constellation