結果

問題 No.2802 Pill Bug in Grid Maze
ユーザー 👑 loop0919
提出日時 2023-10-18 21:29:06
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 332 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 82,788 KB
実行使用メモリ 91,188 KB
最終ジャッジ日時 2024-07-11 19:30:10
合計ジャッジ時間 4,271 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 TLE * 1
other -- * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import lru_cache

MOD = 998244353
H, W = map(int, input().split())

@lru_cache(200**2)
def f(h, w):
    if h <= 1 or w <= 1:
        return 1
    result = 0
    for i in range(1, w+1):
        result += f(i, h-1) * pow(2, (w-i) * (h-1) + max(i-2, 0), MOD) % MOD
        result %= MOD
    return result

print(f(H, W))
0