Skip to content

Instantly share code, notes, and snippets.

@ZeronSix
Created October 20, 2015 14:38
Show Gist options
  • Save ZeronSix/7da1cad8ef3d8a9db0f5 to your computer and use it in GitHub Desktop.
Save ZeronSix/7da1cad8ef3d8a9db0f5 to your computer and use it in GitHub Desktop.
1494. Монобильярд
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