結果

問題 No.612 Move on grid
ユーザー titiatitia
提出日時 2024-01-03 03:30:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 242 ms / 2,500 ms
コード長 508 bytes
コンパイル時間 1,673 ms
コンパイル使用メモリ 81,444 KB
実行使用メモリ 142,696 KB
最終ジャッジ日時 2024-01-03 03:30:42
合計ジャッジ時間 4,976 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
59,828 KB
testcase_01 AC 44 ms
60,212 KB
testcase_02 AC 45 ms
60,724 KB
testcase_03 AC 83 ms
80,668 KB
testcase_04 AC 242 ms
140,508 KB
testcase_05 AC 228 ms
142,696 KB
testcase_06 AC 224 ms
142,696 KB
testcase_07 AC 167 ms
140,536 KB
testcase_08 AC 224 ms
142,696 KB
testcase_09 AC 218 ms
142,696 KB
testcase_10 AC 140 ms
111,184 KB
testcase_11 AC 87 ms
85,020 KB
testcase_12 AC 170 ms
122,688 KB
testcase_13 AC 108 ms
95,100 KB
testcase_14 AC 197 ms
132,220 KB
testcase_15 AC 88 ms
86,344 KB
testcase_16 AC 213 ms
141,756 KB
testcase_17 AC 131 ms
96,464 KB
testcase_18 AC 193 ms
133,628 KB
testcase_19 AC 140 ms
115,820 KB
testcase_20 AC 175 ms
136,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

T=int(input())
a,b,c,d,e=map(int,input().split())

mod=10**9+7

DP=[0]*(20005)
DP[10002]=1

for tests in range(T):
    NDP=[0]*(20005)

    for i in range(20005):
        if DP[i]==0:
            continue

        NDP[i+a]+=DP[i]
        NDP[i-a]+=DP[i]
        NDP[i+b]+=DP[i]
        NDP[i-b]+=DP[i]
        NDP[i+c]+=DP[i]
        NDP[i-c]+=DP[i]

    for i in range(20005):
        DP[i]=NDP[i]%mod

ANS=0
for i in range(d,e+1):
    ANS+=DP[i+10002]

print(ANS%mod)
0