結果

問題 No.612 Move on grid
ユーザー brthyyjpbrthyyjp
提出日時 2022-03-28 17:54:33
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 779 bytes
コンパイル時間 502 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 270,604 KB
最終ジャッジ日時 2024-04-25 00:00:12
合計ジャッジ時間 4,863 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
59,136 KB
testcase_01 AC 51 ms
58,752 KB
testcase_02 AC 63 ms
64,896 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
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 #

import sys
import io, os
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline

def main():

    t = int(input())
    a,b,c,d,e = map(int, input().split())
    from collections import defaultdict
    mod = 10**9+7
    dp = defaultdict(lambda: 0)
    dp[(0, 0, 0)] = 1
    for i in range(t):
        ndp = defaultdict(lambda: 0)
        for (x, y, z), v in dp.items():
            for dx, dy, dz in (-1,0,0),(1,0,0),(0,1,0),(0,-1,0),(0,0,1),(0,0,-1):
                nx, ny, nz = x+dx, y+dy, z+dz
                ndp[(nx, ny, nz)] += v
                ndp[(nx, ny, nz)] += mod
        dp = ndp
    ans = 0
    for (x, y, z), v in dp.items():
        if d <= a*x+b*y+c*z <= e:
            ans += v
            ans %= mod
    print(ans)

if __name__ == '__main__':
    main()
0