Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n, k = map(int , input().split(" "))
- films = [x for x in range(n + 1)]
- filmInDVD = 0
- filmseq = input().split(" ")
- for f in [int(j) for j in filmseq]:
- if f != filmInDVD:
- if filmInDVD != 0:
- films[filmInDVD] = films[f]
- films[f] = 0
- filmInDVD = f
- else:
- films[f] = 0
- films[0] = f
- filmInDVD = f
- s = {k: f if f > 0 else -1 for f, k in enumerate(films)}
- for i in range(1, n + 1):
- print(s[i], end=" ")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement