Problem p03013 (python)

Fixed submission:
# coding: utf-8
import os
import time
import re
import math


def main():
    N,M=map(int,input().split())
    A=[int(input()) for  a in range(M)] #a (1段~N-1段)
    start=time.time();#
    memo=[0]*(N+1)
    memo[0]=1
    ban=[False]*(N+1)
    for a in A:
        ban[a]=True
    mod=1000000007
    for a in range(1,N+1):
        if ban[a]:
            memo[a]=0
        else:
            if a>1:
                memo[a]=(memo[a-1]+memo[a-2])%mod
            else:
                memo[a]=1



    print(memo[-1]%mod)
    #print("{}ms".format(math.floor(time.time()*1000-start*1000)))#


main()

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import os
import time
import re
import math


def main():
    N,M=map(int,input().split())
    A=[int(input()) for  a in range(M)] #a (1段~N-1段)
    start=time.time();#
    memo=[0]*(N+1)
    memo[0]=1
    ban=[False]*(N+1)
    for a in M:
        ban[a]=True
    mod=1000000007
    print(ban)
    for a in range(1,N+1):
        if ban[a]:
            memo[a]=0
        else:
            if a>1:
                memo[a]=(memo[a-1]+memo[a-2])%mod
            else:
                memo[a]=1



    print(memo[-1]%mod)
    #print("{}ms".format(math.floor(time.time()*1000-start*1000)))#


main()

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import os
import time
import re
import math


def main():
    N,M=map(int,input().split())
    A=[int(input()) for  a in range(M)] #a (1段~N-1段)
    start=time.time();#
    memo=[0]*(N+1)
    memo[0]=1
    ban=[False]*(N+1)
    for a in M:
        ban[a]=True
    mod=1000000007
    print(ban)
    for a in range(1,N+1):
        if ban[a]:
            print("ban")
            memo[a]=0
        else:
            if a>1:
                memo[a]=(memo[a-1]+memo[a-2])%mod
            else:
                memo[a]=1



    print(memo[-1]%mod)
    #print("{}ms".format(math.floor(time.time()*1000-start*1000)))#


main()

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import os
import time
import re
import math


def main():
    global N,M,A,mod,memo
    N,M=map(int,input().split())
    A=[int(input()) for  a in range(M)] #a (1段~N-1段)
    start=time.time();#
    memo=[-1]*(N+1)
    
    mod=1000000007
    print(dp(0)%mod)
    #print("{}ms".format(math.floor(time.time()*1000-start*1000)))#

def dp(index):
    if(index>N):return 0
    if(index==N):memo[index]=1
    if(A.count(index)>0):memo[index]=0
    if memo[index]==-1:
        memo[index]=dp(index+1)+dp(index+2)
    return memo[index]

main()

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import os
import time
import re
import math


def main():
    global N,M,A,mod,memo
    N,M=map(int,input().split())
    A=[int(input()) for  a in range(M)] #a (1段~N-1段)
    start=time.time();#
    memo=[-1]*(N+1)
    
    mod=1000000007
    print(dp(0))
    #print("{}ms".format(math.floor(time.time()*1000-start*1000)))#

def dp(index):
    if(index>N):return 0
    if(index==N):memo[index]=1
    if(A.count(index)>0):memo[index]=0
    if memo[index]==-1:
        memo[index]=(dp(index+1)%mod+dp(index+2)%mod)%mod
    return memo[index]

main()

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import os
import time
import re
import math


def main():
    global N,M,A,mod,memo
    N,M=map(int,input().split())
    A=[int(input()) for  a in range(M)] #a (1段~N-1段)
    start=time.time();#
    memo=[-1]*(N+1)
    
    mod=1000000007
    print(dp(0))
    #print("{}ms".format(math.floor(time.time()*1000-start*1000)))#

def dp(index):
    if(index>N):return 0
    if(index==N):memo[index]=1
    if(A.count(index)>0):memo[index]=0
    if memo[index]==-1:
        memo[index]=(dp(index+1)+dp(index+2))%mod
    return memo[index]

main()

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import os
import time
import re
import math


def main():
    global N,M,A,mod,memo
    N,M=map(int,input().split())
    A=[int(input()) for  a in range(M)] #a (1段~N-1段)
    start=time.time();#
    memo=[-1]*(N+1)
    
    mod=1000000007
    print(dp(0))
    #print("{}ms".format(math.floor(time.time()*1000-start*1000)))#

def dp(index):
    print(mod)
    if(index>N):return 0
    if(index==N):memo[index]=1
    if(A.count(index)>0):memo[index]=0
    if memo[index]==-1:
        memo[index]=(dp(index+1)+dp(index+2))%mod
    return memo[index]

main()

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import os
import time
import re
import math


def main():
    global N,M,A,mod,memo
    N,M=map(int,input().split())
    A=[int(input()) for  a in range(M)] #a (1段~N-1段)
    start=time.time();#
    memo=[-1]*(N+1)
    
    mod=10**9+7+1
    print(dp(0))
    #print("{}ms".format(math.floor(time.time()*1000-start*1000)))#

def dp(index):
    global N,M,A,mod,memo
    if(index>N):return 0
    if(index==N):memo[index]=1
    if(A.count(index)>0):memo[index]=0
    if memo[index]==-1:
        memo[index]=(dp(index+1)+dp(index+2))%mod
    return memo[index]

main()

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import os
import time
import re
import math


def main():
    global N,M,A,mod,memo
    N,M=map(int,input().split())
    A=[int(input()) for  a in range(M)] #a (1段~N-1段)
    start=time.time();#
    memo=[-1]*(N+1)
    
    mod=10**9+7
    print(dp(0))
    #print("{}ms".format(math.floor(time.time()*1000-start*1000)))#

def dp(index):
    global N,M,A,mod,memo
    if(index>N):return 0
    if(index==N):memo[index]=1
    if(A.count(index)>0):memo[index]=0
    if memo[index]==-1:
        memo[index]=(dp(index+1)+dp(index+2))%mod
    return memo[index]

main()

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import os
import time
import re
import math


def main():
    global N,M,A,mod,memo
    N,M=map(int,input().split())
    A=[int(input()) for  a in range(M)] #a (1段~N-1段)
    start=time.time();#
    memo=[-1]*(N+1)
    
    mod=10**9+7
    print(dp(0))
    #print("{}ms".format(math.floor(time.time()*1000-start*1000)))#

def dp(index):
    global N,M,A,mod,memo
    if(index>N):memo[index]=0
    if(index==N):memo[index]=1
    if(A.count(index)>0):memo[index]=0
    if memo[index]==-1:
        memo[index]=(dp(index+1)+dp(index+2))%mod
    return memo[index]

main()

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import os
import time
import re
import math


def main():
    global N,M,A,mod,memo
    N,M=map(int,input().split())
    A=[int(input()) for  a in range(M)] #a (1段~N-1段)
    start=time.time();#
    memo=[-1]*(N+1)
    
    mod=10**9+7
    print(dp(0))
    #print("{}ms".format(math.floor(time.time()*1000-start*1000)))#

def dp(index):
    global N,M,A,mod,memo
    if(index>N):return 0
    if(index==N):return 1
    if(A.count(index)>0):return 0
    if memo[index]==-1:
        memo[index]=(dp(index+1)+dp(index+2))%mod
    return memo[index]

main()