結果

問題 No.612 Move on grid
ユーザー りあん
提出日時 2017-12-01 18:46:20
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 624 bytes
コンパイル時間 509 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 23,008 KB
最終ジャッジ日時 2024-11-27 22:42:55
合計ジャッジ時間 49,671 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 6 TLE * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())
a, b, c, d, e = map(int, input().split())
M = 1000000007
m = 20020
s = 10010
dp = [0 for i in range(m)]
dp[s] = 1
for i in range(t):
    nex = [0 for i in range(m)]
    for j in range(m):
        if dp[j] > 0:
            nex[j + a] = (nex[j + a] + dp[j]) % M
            nex[j - a] = (nex[j - a] + dp[j]) % M
            nex[j + b] = (nex[j + b] + dp[j]) % M
            nex[j - b] = (nex[j - b] + dp[j]) % M
            nex[j + c] = (nex[j + c] + dp[j]) % M
            nex[j - c] = (nex[j - c] + dp[j]) % M

    dp = nex

ans = 0
for i in range(s + d, s + e + 1):
    ans = (ans + dp[i]) % M

print(ans)
0