nq1s788

Лентяй (СКАНЛАЙН)

Sep 27th, 2025
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. n = int(input())
  2. a = []
  3. for i in range(n):
  4.     x, y = map(int, input().split())
  5.     a.append((x, 1))
  6.     a.append((y, 2))
  7. a.sort()
  8. b = 0
  9. for i in range(2 * n):
  10.     if a[i][1] == 1:
  11.         b += 1
  12.     else:
  13.         b -= 1
  14.     if b == n:
  15.         print('YES')
  16.         exit(0)
  17. print('NO')
Advertisement
Add Comment
Please, Sign In to add comment