mfgnik

Untitled

Jun 27th, 2020
1,299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. from collections import namedtuple
  2. Point = namedtuple('Point', ['x', 'y'])
  3. points_amount = int(input())
  4. points = set()
  5. for index in range(points_amount):
  6.     points.add(Point(*map(int, input().split())))
  7. points = sorted(points)
  8. x_lines = set()
  9. y_lines = set()
  10. for current_point, next_point in zip(points, points[1:]):
  11.     if current_point.x == next_point.x and next_point.y > current_point.y:
  12.         y_lines.add(current_point.y + 1)
  13.     else:
  14.         x_lines.add(current_point.x + 1)
  15. print(len(x_lines) + len(y_lines))
  16. for index in y_lines:
  17.     print("y {}".format(index))
  18. for index in x_lines:
  19.     print("x {}".format(index))
Advertisement
Add Comment
Please, Sign In to add comment