vadim_sharaf

Untitled

Oct 25th, 2021
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. f = open ('26.txt')
  2. next(f)
  3. def razdel(s):
  4.     st = tuple(map(int, s.split()))
  5.     return st[0], -st[1]
  6. def poisk(k):
  7.     one = k[0]
  8.     two = k[1]
  9.     return one[0] == two[0] and two[1] - one[1] == 3
  10. pairs = sorted(map(razdel, f))
  11. fil = filter(poisk, zip(pairs, pairs[1:]))
  12. true = tuple(map(lambda x: x[1], fil))
  13. print(true[-1][0], (-true[-1][1]))
Advertisement
Add Comment
Please, Sign In to add comment