Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = int(input())
- a = []
- for i in range(n):
- x, y = map(int, input().split())
- a.append((x, 1))
- a.append((y, 2))
- a.sort()
- b = 0
- for i in range(2 * n):
- if a[i][1] == 1:
- b += 1
- else:
- b -= 1
- if b == n:
- print('YES')
- exit(0)
- print('NO')
Advertisement
Add Comment
Please, Sign In to add comment