Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import namedtuple
- Point = namedtuple('Point', ['x', 'y'])
- points_amount = int(input())
- points = set()
- for index in range(points_amount):
- points.add(Point(*map(int, input().split())))
- points = sorted(points)
- x_lines = set()
- y_lines = set()
- for current_point, next_point in zip(points, points[1:]):
- if current_point.x == next_point.x and next_point.y > current_point.y:
- y_lines.add(current_point.y + 1)
- else:
- x_lines.add(current_point.x + 1)
- print(len(x_lines) + len(y_lines))
- for index in y_lines:
- print("y {}".format(index))
- for index in x_lines:
- print("x {}".format(index))
Advertisement
Add Comment
Please, Sign In to add comment