nq1s788

26 пара мест в ряду перед которыми никто не сидит

Apr 4th, 2026
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. #https://inf-ege.sdamgia.ru/problem?id=69934
  2. data = open('69934.txt').readlines()
  3. n, m, k = map(int, data[0].split())
  4. inf = 10000000
  5. best_row = [inf] * (k + 1)
  6. for e in data[1:]:
  7.     x, y = map(int, e.split())
  8.     best_row[y]= min(best_row[y], x - 1)
  9. mx_x = -1
  10. mx_y = -1
  11. for i in range(1, k):
  12.     cur_row = min(best_row[i], best_row[i + 1])
  13.     if cur_row >= mx_x and cur_row != inf:
  14.         mx_x = cur_row
  15.         mx_y = i + 1
  16. print(mx_x, mx_y)
Advertisement
Add Comment
Please, Sign In to add comment