Problem p03013 (python)

Fixed submission:
n, m = map(int, input().split())
issafe = [True] * (n +1)
for _ in range(m):
    a = int(input())
    issafe[a] = False

dp = [0] * (n + 1)
dp[0] = 1
if issafe[1]:
    dp[1] = 1

for i in range(2, n + 1):
    if  issafe[i - 1]:
        dp[i] = dp[i] + dp[i - 1]
    if issafe[i -  2]:
        dp[i] = dp[i - 2] + dp[i] 
    
    dp[i] %= 1000000007
    
print(dp[n])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
issafe = [True] * n + 1
for _ in range(m):
    a = int(input())
    issafe[a] = False
 
dp = [0] * n +1
dp[0] = 1
if issafe[1]:
    dp[1] = 1
 
for i in range(2, n + 1):
    if  issafe[i - 1]:
        dp[i] = dp[i] + dp[i - 1]
    if issafe[i -  2]:
        dp[i] = dp[i - 2] + dp[i] 
    
    dp[i] %= 1000000007
    
print(dp[n])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
issafe = [True] * n
for _ in range(m):
    a = int(input())
    issafe[a] = False
 
dp = [0] * n
dp[0] = 1
if issafe[1]:
    dp[1] = 1
 
for i in range(2, n + 1):
    if  issafe[i - 1]:
        dp[i] = dp[i] + dp[i - 1]
    if issafe[i -  2]:
        dp[i] = dp[i - 2] + dp[i] 
    
    dp[i] %= 1000000007
    
print(dp[n])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
issafe = [True] * n
for _ in range(m):
    a = int(input())
    issafe[a] = False

dp = [0] * n
dp[0] = 1
if issafe[1]:
    dp[1] = 1

for i in range(2, n + 1):
    if  issafe[i - 1]:
        dp[i] = dp[i] + dp[i - 1]
    if issafe[i -  2]:
        dp[i] = dp[i - 2] + dp[i] 
    
    dp[i] %= 1000000007
    
print(dp[n])

Buggy submission (verdict: Runtime Error):
, m = map(int, input().split())
issafe = [True] * 10000
for _ in range(m):
    a = int(input())
    issafe[a] = False

dp = [0] * 10000
dp[0] = 1
if issafe[1]:
    dp[1] = 1

for i in range(2, n + 1):
    if  issafe[i - 1]:
        dp[i] = dp[i] + dp[i - 1]
    if issafe[i -  2]:
        dp[i] = dp[i - 2] + dp[i] 
    
    dp[i] %= 1000000007
    
print(dp[n])

Buggy submission (verdict: Runtime Error):
, m = map(int, input().split())
issafe = [True] * 10000
for _ in range(m):
    a = int(input())
    issafe[a] = False

dp = [0] * 10000
dp[0] = 1
if issafe[1]:
    dp[1] = 1

for i in range(1, n + 1):
    if  issafe[i - 1]:
        dp[i] = dp[i] + dp[i - 1]
    if issafe[i -  2]:
        dp[i] = dp[i - 2] + dp[i] 
    
    dp[i] %= 1000000007
    
print(dp[n])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
issafe = [True] * 10001
for _ in range(m):
    a = int(input())
    issafe[a] = False

dp = [0] * 10001
dp[0] = 1
if issafe[1]:
    dp[1] = 1

for i in range(2, n + 1):
    if  issafe[i - 1]:
        dp[i] = dp[i] + dp[i - 1]
    if issafe[i -  2]:
        dp[i] = dp[i - 2] + dp[i] 
    
    dp[i] %= 1000000007
    
print(dp[n])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
issafe = [True] * 10000
for _ in range(m):
    a = int(input())
    issafe[a] = False

dp = [0] * 10000
dp[0] = 1
if issafe[1]:
    dp[1] = 1

for i in range(2, n + 1):
    if  issafe[i - 1]:
        dp[i] = dp[i] + dp[i - 1]
    if issafe[i -  2]:
        dp[i] = dp[i - 2] + dp[i] 
    
    dp[i] %= 1000000007
    
print(dp[n])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = {int(input()) for _ in range(m)}

dp = [0] * 10000
dp[0] = 1
if 1 not in a:
    dp[1] = 1

for i in range(2, n + 1):
    if  (i - 1) not in a:
        dp[i] = dp[i] + dp[i - 1]
    if (i - 2) not in a:
        dp[i] = dp[i - 2] + dp[i] 
    
    dp[i] %= 1000000007
    
print(dp[n])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]
 
dp = [0] * 10000
dp[0] = 1
if 1 not in a:
    dp[1] = 1
    
for i in range(2, n + 1):
    if  (i - 1) not in a:
        dp[i] = dp[i] + dp[i - 1]
    if (i - 2) not in a:
        dp[i] = dp[i] + dp[i - 2]
 
    dp[i] %= 1000000007    
print(dp[n])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = int(input()) for _ in range(m)

dp = [0] * 10000
dp[0] = 1
if 1 not in a:
    dp[1] = 1
    
for i in range(2, n + 1):
    if  (i - 1) not in a:
        dp[i] = dp[i] + dp[i - 1]
    if (i - 2) not in a:
        dp[i] = dp[i] + dp[i - 2]

    dp[i] %= 1000000007    
print(dp[n])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = int(input()) for _ in range(m)
 
dp = [0] * 10000
dp[0] = 1
if 1 not in a:
    dp[1] = 1
 
for i in range(2, n + 1):
    if  (i - 1) not in a:
        dp[i] = dp[i] + dp[i - 1]
    if (i - 2) not in a:
        dp[i] = dp[i - 2] + dp[i] 
    
    dp[i] %= 1000000007
    
print(dp[n])

Buggy submission (verdict: Runtime Error):
#ABC129C 動的計画法

n, m = map(int, input().split())
a = int(input()) for _ in range(m)

dp = [0] * 10000
dp[0] = 1
if 1 not in a:
    dp[1] = 1

for i in range(2, n + 1):
    if  (i - 1) not in a:
        print("/", dp[i])
        dp[i] = dp[i] + dp[i - 1]
        print("●  dp[{0}]={2}  dp[{1}]={3}".format(i-1, i, dp[i - 1],  dp[i]))
    if (i - 2) not in a:
        print("//", dp[i])
        dp[i] = dp[i - 2] + dp[i] 
        print("■  dp[{0}]={2}  dp[{1}]={3}".format(i-2, i, dp[i - 1],  dp[i]))
    
    print("dp[{0}]={1}".format(i, dp[i]))
    
    dp[i] %= 1000000007
    
print(dp[n])