Problem: There is a staircase with N steps. Takahashi is now standing at the foot of the stairs, that is, on the 0-th step. He can climb up one or two steps at a time.  However, the treads of the a_1-th, a_2-th, a_3-th, \ldots, a_M-th steps are broken, so it is dangerous to set foot on those steps.  How many are there to climb up to the top step, that is, the N-th step, without setting foot on the broken steps? Find the count modulo 1\ 000\ 000\ 007.

Submission attempts (in order):
N, M = map(int, input().split())
a = [ int(input()) for _ in range(N)]

ans = 0

step = [0 for _ in range(N + 2)]
step[1] = 1

for _ in range(M):
  i = int(input()) + 1
  step[i] = -1

for i in range(2, N + 2):
  if step[i] == -1:
    step[i] = 0
  else:
    step[i] = (step[i - 2] + step[i - 1]) % N

print (ans % 1000000007)


N, M = map(int, input().split())

step = [0 for _ in range(N + 2)]
step[1] = 1

for _ in range(M):
  i = int(input()) + 1
  step[i] = -1

for i in range(2, N + 2):
  if step[i] == -1:
    step[i] = 0
  else:
    step[i] = step[i - 2] + step[i - 1]

print (step[N] % 1000000007)


N, M = map(int, input().split())
a = [ int(input()) for _ in range(N)]

ans = 0

step = [0 for _ in range(N + 2)]
step[1] = 1

for _ in range(M):
  i = int(input()) + 1
  step[i] = -1

for i in range(2, N + 2):
  if step[i] == -1:
    step[i] = 0
  else:
    step[i] = (step[i - 2] + step[i - 1]) % N

print (step[N] % 1000000007)


N, M = map(int, input().split())

step = [0 for _ in range(N + 2)]
step[1] = 1

for _ in range(M):
  i = int(input()) + 1
  step[i] = -1

for i in range(2, N + 2):
  if step[i] == -1:
    step[i] = 0
  else:
    step[i] = (step[i - 2] + step[i - 1]) % N

print (ans % 1000000007)


N, M = map(int, input().split())

step = [0 for _ in range(N + 2)]
step[1] = 1

for _ in range(M):
  i = int(input()) + 1
  step[i] = -1

for i in range(2, N + 2):
  if step[i] == -1:
    step[i] = 0
  else:
    step[i] = (step[i - 2] + step[i - 1]) % N

print (ans % 1000000007)


N, M = map(int, input().split(" "))
AL = list(map(int, [input() for _ in range(M)]))

# DP
dp = [1] * (N )
for A in AL:
    dp[A] = 0

for i in range(2, N):
    if dp[i] == 1:
        dp[i] = (dp[i-1] + dp[i-2]) % (10**9 + 7)
print(dp[N])


N, M = map(int, input().split())

step = [0 for _ in range(N + 2)]
step[1] = 1

for _ in range(M):
  i = int(input()) + 1
  step[i] = -1

for i in range(2, N + 2):
  if step[i] == -1:
    step[i] = 0
  else:
    step[i] = (step[i - 2] + step[i - 1]) % N

print (step[N] % 1000000007)




N, M = map(int, input().split())
broken = [list(map(int, input().split())) for i in range(M)]

stair = [0 for _ in range(N + 1)]
stair[0] = 1
stair[1] = 1

for i in range(2, N + 1):
  if stair[i] in broken:
    continue
  else:
    stair[i] = stair[i - 2] + stair[i - 1]

print (stair[N] % 1000000007)


N, M = map(int, input().split(" "))
AL = list(map(int, [input() for _ in range(M)]))

# DP
dp = [1] * (N + 1)
for A in AL:
    dp[A] = 0

for i in range(2, N):
    if dp[i] == 1:
        dp[i] = (dp[i-1] + dp[i-2]) % (10**9 + 7)
print(dp[N])


N, M = map(int, input().split())

step = [0 for _ in range(N + 2)]
step[0] = 1
step[1] = 1

for _ in range(M):
  i = int(input()) + 1
  step[i] = -1

for i in range(2, N ):
  if step[i] == -1:
    step[i] = 0
  else:
    step[i] = step[i - 2] + step[i - 1]

print (step[-1] % 1000000007)


N, M = map(int, input().split())
A = list(map(int, [input() for _ in range(M)]))

step = [1 for _ in range(N + 1)]
step[0] = 1
step[1] = 1

for i in A:
    dp[i] = 0

for i in range(2, N + 1):
    if step[i] == 1:
        step[i] = step[i-1] + step[i-2]

print (step[-1] % 1000000007)


N, M = map(int, input().split())

step = [0 for _ in range(N + 2)]
step[1] = 1

for _ in range(M):
  i = int(input()) + 1
  step[i] = -1

for i in range(2, N + 2):
  if step[i] == -1:
    step[i] = 0
  else:
    step[i] = (step[i - 2] + step[i - 1]) % N

print (step[N] % 1000000007)




N, M = map(int, input().split())

step = [0 for _ in range(N + 2)]
step[1] = 1

for _ in range(M):
  i = int(input()) + 1
  step[i] = -1

for i in range(2, N + 2):
  if step[i] == -1:
    step[i] = 0
  else:
    step[i] = step[i - 2] + step[i - 1]

print (step[-1] % 1000000007)


Verdicts: Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Accepted