結果

問題 No.2802 Pill Bug in Grid Maze
ユーザー hiro1729
提出日時 2023-10-19 07:55:59
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 274 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 82,688 KB
最終ジャッジ日時 2024-07-11 19:30:19
合計ジャッジ時間 4,547 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 4 TLE * 1 -- * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import comb
H, W = map(int, input().split())
if H == 1 or W == 1:
	exit(print(1))
mod = 998244353
ans = 0
for i in range(H + W - 2):
	x = i // 2
	y = i // 2 + i % 2
	ans += pow(2, (H - 1) * (W - 1) - i, mod) * comb(H - 2, x) * comb(W - 1, y) % mod
print(ans % mod)
0