You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 3 години
преди 3 години
преди 3 години
123456789101112131415161718192021
  1. dots, instructions = open(0).read().split('\n\n')
  2. dots = {eval(pair) for pair in dots.splitlines()}
  3. ans1 = None
  4. for line in instructions.splitlines():
  5. axis, zz = line.split()[-1].split('=')
  6. zz = int(zz)
  7. if axis == 'x':
  8. dots = {(x, y) if x < zz else (2 * zz - x, y) for x, y in dots}
  9. elif axis == 'y':
  10. dots = {(x, y) if y < zz else (x, 2 * zz - y) for x, y in dots}
  11. if ans1 is None:
  12. ans1 = len(dots)
  13. x, *_, X = sorted(x for x, y in dots)
  14. y, *_, Y = sorted(y for x, y in dots)
  15. ans2 = ''
  16. for yi in range(y, Y + 1):
  17. for xi in range(x, X + 1):
  18. ans2 += '#' if (xi, yi) in dots else ' '
  19. ans2 += '\n'
  20. print(ans1)
  21. print(ans2)