We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. All Contests
  2. ProjectEuler+
  3. Project Euler #252: Convex Holes

Project Euler #252: Convex Holes

Problem
Submissions
Leaderboard
Discussions
  1. All Contests
  2. ProjectEuler+
  3. Project Euler #252: Convex Holes
Exit Full Screen View
  • Problem
  • Submissions
  • Leaderboard
  • Discussions

This problem is a programming version of Problem 252 from projecteuler.net

Given a set of points on a plane, we define a convex hole as a strictly convex polygon such that:

  1. the vertices are from the set of given points;
  2. the polygon is convex;
  3. none of the elements of the given set lie in the interior of the polygon. Non-vertex elements from the given set may lie on the boundary;
  4. no three consecutive vertices are colinear.

As an example, the image below shows a set of twenty points and a few such convex holes. The convex hole shown as a red heptagon has an area equal to square units, which is the highest possible area for a convex hole on the given set of points.

For our example, we used the first points , for , produced with the pseudo-random number generator (given and ):

-
i.e. , −, − −, …

Given integers , and , generate ordered pairs with the pseudo-random sequence with parameters and . If a pair appears more than once, remove all but one occurrence. What is the maximum area of a convex hole with vertices from this set of points? How many different convex holes are there?

Input Format

Each test file contains lines containing the integer values of , and .

Constraints

Output Format

Print your solution in two lines. On the first line print the maximum convex hole area with exactly one digit after the decimal point. On the second line print the integer value of the number of convex holes.

Sample Input 0

50
290797
50515093

Sample Output 0

584388.5  
16186 

Explanation 0

All of the generated points are unique. The largest area convex hole has area and there are different convex holes.

  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature