結果

問題 No.612 Move on grid
ユーザー mkawa2mkawa2
提出日時 2020-06-04 18:18:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,134 ms / 2,500 ms
コード長 424 bytes
コンパイル時間 492 ms
コンパイル使用メモリ 86,856 KB
実行使用メモリ 144,552 KB
最終ジャッジ日時 2023-08-19 21:40:48
合計ジャッジ時間 11,729 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
71,408 KB
testcase_01 AC 87 ms
71,548 KB
testcase_02 AC 86 ms
71,476 KB
testcase_03 AC 152 ms
77,720 KB
testcase_04 AC 166 ms
79,984 KB
testcase_05 AC 1,100 ms
141,980 KB
testcase_06 AC 1,131 ms
144,352 KB
testcase_07 AC 141 ms
79,880 KB
testcase_08 AC 1,134 ms
144,552 KB
testcase_09 AC 525 ms
94,440 KB
testcase_10 AC 436 ms
92,080 KB
testcase_11 AC 185 ms
78,836 KB
testcase_12 AC 706 ms
109,664 KB
testcase_13 AC 276 ms
84,112 KB
testcase_14 AC 870 ms
124,636 KB
testcase_15 AC 211 ms
79,368 KB
testcase_16 AC 1,038 ms
134,064 KB
testcase_17 AC 213 ms
79,820 KB
testcase_18 AC 840 ms
121,280 KB
testcase_19 AC 319 ms
82,604 KB
testcase_20 AC 396 ms
84,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

t=int(input())
a,b,c,d,e=map(int,input().split())
md=10**9+7

dp=defaultdict(int)
dp[0]=1
for i in range(t):
    ndp=defaultdict(int)
    for s,k in dp.items():
        ndp[s+a]+=k
        ndp[s-a]+=k
        ndp[s+b]+=k
        ndp[s-b]+=k
        ndp[s+c]+=k
        ndp[s-c]+=k
    for s in ndp.keys():ndp[s]%=md
    dp=ndp

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

print(ans)
0