結果
問題 | No.612 Move on grid |
ユーザー |
|
提出日時 | 2021-07-23 16:14:34 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 223 ms / 2,500 ms |
コード長 | 794 bytes |
コンパイル時間 | 145 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 141,696 KB |
最終ジャッジ日時 | 2024-07-18 11:48:11 |
合計ジャッジ時間 | 3,827 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 |
ソースコード
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(2*10**5+10) write = lambda x: sys.stdout.write(x+"\n") debug = lambda x: sys.stderr.write(x+"\n") writef = lambda x: print("{:.12f}".format(x)) t = int(input()) a,b,c,d,e = list(map(int, input().split())) m = 10000 dp = [0]*(2*m+1) dp[m] = 1 M = 10**9+7 for i in range(t): ndp = [0]*(2*m+1) for j in range(2*m+1): val = dp[j] if val==0: continue ndp[j+a] = (ndp[j+a] + val) % M ndp[j-a] = (ndp[j-a] + val) % M ndp[j+b] = (ndp[j+b] + val) % M ndp[j-b] = (ndp[j-b] + val) % M ndp[j+c] = (ndp[j+c] + val) % M ndp[j-c] = (ndp[j-c] + val) % M dp = ndp ans = 0 for i in range(d, e+1): ans += dp[i+m] ans %= M print(ans%M)