Created
October 20, 2015 14:38
-
-
Save ZeronSix/7da1cad8ef3d8a9db0f5 to your computer and use it in GitHub Desktop.
1494. Монобильярд
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = int(input()) | |
a = [] | |
for _ in range(0, n): | |
a.append(int(input())) | |
stack = [] | |
max_taken = 0 | |
for i in range(0, n): | |
if a[i] > max_taken: | |
for j in range(max_taken + 1, a[i] + 1): | |
stack.append(j) | |
last = stack[len(stack) - 1] | |
if last == a[i]: | |
if stack.pop() > max_taken: | |
max_taken = last | |
elif last > a[i]: | |
print("Cheater") | |
break | |
else: | |
print("Not a proof") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment