Only Integers Allowed
Practice
3.7 (139 votes)
Geometry
Open
Approved
Easy Medium
Problem
71% Success 2842 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code
You have a polygon described by coordinates of its vertices. Can you find how many points with integer coordinates lay strictly inside it?
Input
The first line contains an integer N - number of vertices.
Next N lines contain 2 space-separated integers each and describe polygon vertices in clockwise order. Note that polygon can be convex and non-convex as well.
Output
Output one integer - answer for the problem
Constraints
- 3 <= N <= 1000
- |xi|, |yi| <= 106
Sample Input
4 0 0 0 2 2 2 2 0
Sample Output
1
Code Editor
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Submissions
Please login to view your submissions
Similar Problems
No similar problems found
Editorial
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor