You are given a finite set of S points on the plane. For each real i, one of these points has coordinates (x [i], y [i]). All points and three of them are not collinear.
Below, CH (s) denotes the convex hull of the set s, i.e. smallest of all convex polygons containing the set s. We say that an ordered pair (s1, s2) is interesting if the following conditions are satisfied:
1.s1 is a subset of S
2.s2 is a subset of S
3. the sets s1 and s2 do not intersect (that is, they do not have common elements)
4. The intersection of the convex hulls CH (s1) and CH (s2) has a positive area. Note that some points from S may remain unused (i.e., they will not be in s1 or s2). You are given the coordinates of all points: sx and y. Please calculate and return the number of interesting pairs of sets, modulo 10 ^ 9 + 7.
Examples
{1,0, -1, -1,0,1} {1,2,1, -1, -2, -1}
Returns: 14
We have 14 solutions:
s1 = {0,1,3}, s2 = {2,4,5} s1 = {0,2,3}, s2 = {1,4,5} s1 = {0,1,4}, s2 = {2,3,5} s1 = {0,2,4}, s2 = {1,3,5} s1 = {1,2,4}, s2 = {0,3,5} s1 = {0,3,4}, s2 = {1,2,5} s1 = {1,3,4}, s2 = {0,2,5} s1 = {0,2,5}, s2 = {1,3,4} s1 = {1,2,5}, s2 = {0,3,4} s1 = {0,3,5}, s2 = {1,2,4} s1 = {1,3,5}, s2 = {0,2,4} s1 = {2,3,5}, s2 = {0,1,4} s1 = {1,4,5}, s2 = {0,2,3} s1 = {2,4,5}, s2 = {0,1,3}
, , . , ccw? ?
, - , google?