結果

問題 No.2802 Pill Bug in Grid Maze
ユーザー 👑 loop0919
提出日時 2023-10-18 21:20:47
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 332 bytes
コンパイル時間 502 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 89,344 KB
最終ジャッジ日時 2024-07-11 19:30:06
合計ジャッジ時間 5,105 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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