Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- inp = open("input.txt")
- out = open("output.txt", "w")
- pos, n = [int(x) for x in inp.readline().split()]
- a = []
- for i in range(n):
- a.append([int(x) for x in inp.readline().split()][::-1])
- a.sort(reverse=True)
- for i in range(n):
- if pos == a[i][1]:
- pos += 1
- elif pos == a[i][1] + 1:
- pos -= 1
- out.write(str(pos))
Advertisement
Add Comment
Please, Sign In to add comment