Pineapple Pizza
Time limit1sMemory limit256 MB
Given n points and a center Q, decide whether k rays from Q can split the plane so every sector holds exactly n/k points, with no point on a ray.
- Level
Hard8 of 10
- Topics
- Geometry, Sorting, Binary search, Two pointers
- Solved
- No attempts yet
Problem
There is a very large pineapple pizza. It is so large that it is treated as an infinite two-dimensional plane. The pizza has pineapple pieces, written as points . Each piece counts as a point with no area. A point and a number of people are given. Draw rays that start at and split the pizza into parts. Every part must hold the same number of pineapple pieces. No pineapple piece may lie on a border line. Write a program that decides whether such rays exist.
Input
The first line gives and (). The next lines give the coordinates of the points . Line gives the and coordinates of . Line gives the and coordinates of . All points and the point are pairwise distinct. Every coordinate is an integer from to .
Output
Print YES when such rays exist, and NO otherwise.
Hint
See the figure below.
