This page is still under construction.

Parts of this page are still being built. What you see may change.

convex4gon

Time limit2sMemory limit1024 MB

Summary
Given n points with no three collinear, count the convex quadrilaterals that can be formed from four of them.
Level

Medium5 of 10

Topics
Geometry, Combinatorics, Brute force
Solved
No attempts yet

Problem

There is a point set of nn distinct points on the xyxy-plane (0<n<300<n<30). Every xx- and yy-coordinate is an integer whose absolute value is less than 10001000. No three distinct points in the set lie on the same line. Count the distinct convex quadrilaterals whose vertices are points from the set.

Input

Write a function convex4gon. The parameter L is a list of length nn. Each item is a tuple of length 2 holding the x- and y-coordinates of a point, and both coordinates are int objects.

Return value

Return an int object equal to the number of distinct convex quadrilaterals whose vertices are points from the set.

Examples1

  1. Example 1

    Input
    1
    0 0
    
    Expected output
    0