Only Integers Allowed

3.7

139 votes
Geometry, Open, Approved, Easy-Medium
Problem

See Russian translation

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
Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?