結果

問題 No.612 Move on grid
ユーザー りあんりあん
提出日時 2017-12-01 18:46:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 624 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 15,704 KB
最終ジャッジ日時 2023-08-18 16:13:57
合計ジャッジ時間 6,650 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
15,704 KB
testcase_01 AC 23 ms
8,648 KB
testcase_02 AC 31 ms
8,548 KB
testcase_03 AC 622 ms
8,700 KB
testcase_04 AC 1,653 ms
8,692 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

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