結果

問題 No.2230 Good Omen of White Lotus
ユーザー ああいいああいい
提出日時 2023-02-25 17:47:37
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 809 bytes
コンパイル時間 1,244 ms
コンパイル使用メモリ 86,636 KB
実行使用メモリ 829,264 KB
最終ジャッジ日時 2023-10-11 15:01:47
合計ジャッジ時間 7,404 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
71,572 KB
testcase_01 AC 95 ms
71,284 KB
testcase_02 AC 96 ms
71,496 KB
testcase_03 AC 95 ms
71,320 KB
testcase_04 AC 95 ms
71,572 KB
testcase_05 AC 96 ms
71,276 KB
testcase_06 AC 96 ms
71,632 KB
testcase_07 AC 95 ms
71,580 KB
testcase_08 AC 93 ms
71,204 KB
testcase_09 AC 95 ms
71,324 KB
testcase_10 AC 95 ms
71,408 KB
testcase_11 AC 96 ms
71,412 KB
testcase_12 AC 99 ms
71,632 KB
testcase_13 AC 103 ms
72,252 KB
testcase_14 AC 335 ms
94,160 KB
testcase_15 AC 187 ms
83,336 KB
testcase_16 AC 370 ms
100,168 KB
testcase_17 AC 373 ms
100,160 KB
testcase_18 AC 376 ms
100,032 KB
testcase_19 AC 381 ms
100,308 KB
testcase_20 AC 160 ms
80,052 KB
testcase_21 AC 140 ms
79,924 KB
testcase_22 AC 161 ms
80,744 KB
testcase_23 AC 162 ms
80,708 KB
testcase_24 MLE -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

H,W,N,P = map(int,input().split())
s = set()
for _ in range(N):
    x,y = map(int,input().split())
    s.add((x-1,y-1))
dp = [[0] * W for _ in range(H)]
memo = [[0] * W for _ in range(H)]
from collections import deque
stack = deque([(0,0)])
while stack:
    x,y = stack.popleft()
    for i,j in [(1,0),(0,1)]:
        if x + i < H and y + j < W:
            if memo[x + i][y + j] == 0:
                memo[x + i][y + j] = 1
                stack.append((x + i,y + j))
            if (x + i,y + j) in s:
                t = dp[x][y] + 1
            else:
                t = dp[x][y]
            if t > dp[x + i][y + j]:
                dp[x + i][y + j] = t
u = dp[-1][-1]
mod = 998244353
v = H + W - 3 - u
r = pow(P,mod-2,mod)
tmp = pow((1-r)%mod,v,mod)*pow((1-r * 2)%mod,u,mod)
ans = (1-tmp)%mod
print(ans)
0