Chino's Latte Art
Time limit1sMemory limit1024 MB
Given a simple polygon, decide whether one reflex vertex and one convex vertex form a symmetry axis that splits it into two convex halves.
- Level
Hard8 of 10
- Topics
- Geometry, String matching, Implementation
- Solved
- No attempts yet
Problem
Chino practices making heart-shaped latte art. Cocoa comes across the traces of Chino's many practice attempts and wants to know how many of the latte arts are heart-shaped. Write a program that decides whether a latte art is heart-shaped, for Cocoa.
In this problem, Chino's latte art is a simple polygon.
A polygon is heart-shaped if there exist vertices and of the polygon such that all of the following conditions hold.
- The interior angle at is less than degrees, and the interior angle at is greater than degrees.
- The given polygon is symmetric about the line .
- The two parts formed when the given polygon is cut along the segment are both convex polygons.
Input
The first line contains the number of vertices of the polygon. ()
Each of the next lines contains the coordinate and the coordinate of a vertex, separated by a space. (, , are integers)
The vertices are given clockwise, starting from an arbitrary point.
No vertex of the given polygon has an interior angle of exactly degrees.
Output
If the given polygon is heart-shaped, print 1. Otherwise, print 0.