#!/usr/bin/env python3 from math import hypot from sys import exit from shapely.geometry import Point from shapely.geometry.polygon import Polygon MAX_N = 5000 def read_shape(): n = int(input()) assert 3 <= n and n <= MAX_N, 'N must be between 3 and {}'.format(MAX_N) xys = [] for i in range(n): x, y = map(int, input().split()) assert abs(x) <= 10000, '|x,y| must be <= 10^4' assert abs(y) <= 10000, '|x,y| must be <= 10^4' xys += [(x, y)] return xys def has_repeats(p): a = set(p) return len(a) != len(p) """ https://shapely.readthedocs.io/en/stable/reference/shapely.contains.html#shapely.contains """ def contains_origin(p): return p.contains(Point(0, 0)) def is_simple_polygon(p): return p.is_valid and p.is_simple for i in range(1,3): shape = read_shape() if has_repeats(shape): print('Shape{:d} has a repeated point'.format(i)) exit(1) p = Polygon(shape) if not contains_origin(p): print('Shape {:d} does not contain the origin fully'.format(i)) exit(1) if not is_simple_polygon(p): print('Shape {:d} is not a simple polgyon'.format(i)) exit(1) exit(42)