結果

問題 No.612 Move on grid
ユーザー yuppe19 😺
提出日時 2017-12-12 10:40:00
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 842 bytes
コンパイル時間 335 ms
コンパイル使用メモリ 7,072 KB
実行使用メモリ 15,700 KB
最終ジャッジ日時 2024-12-14 04:54:24
合計ジャッジ時間 53,023 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 4 TLE * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/python2
# -*- coding: utf-8 -*-
# †
from collections import defaultdict

mod = 10**9 + 7

T = int(raw_input())
a, b, c, d, e = map(int, raw_input().split())
dp = [0] * 50000
dp[0] = 1
for t in xrange(T):
    ndp = [0] * 50000
    for cur in xrange(50000):
        if dp[cur] == 0:
            continue
        ndp[cur + a + 60] += dp[cur]
        ndp[cur + a + 60] %= mod
        ndp[cur - a + 60] += dp[cur]
        ndp[cur - a + 60] %= mod
        ndp[cur + b + 60] += dp[cur]
        ndp[cur + b + 60] %= mod
        ndp[cur - b + 60] += dp[cur]
        ndp[cur - b + 60] %= mod
        ndp[cur + c + 60] += dp[cur]
        ndp[cur + c + 60] %= mod
        ndp[cur - c + 60] += dp[cur]
        ndp[cur - c + 60] %= mod
    dp = ndp

res = 0
for r in xrange(max(0, d+T*60), e+T*60+1):
    res += dp[r]
    res %= mod
print res
0