結果

問題 No.2230 Good Omen of White Lotus
ユーザー ああいいああいい
提出日時 2023-02-25 17:50:29
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 739 bytes
コンパイル時間 329 ms
コンパイル使用メモリ 86,800 KB
実行使用メモリ 842,060 KB
最終ジャッジ日時 2023-10-11 15:04:17
合計ジャッジ時間 8,306 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,340 KB
testcase_01 AC 92 ms
71,516 KB
testcase_02 AC 92 ms
71,336 KB
testcase_03 AC 92 ms
71,492 KB
testcase_04 AC 91 ms
71,256 KB
testcase_05 AC 92 ms
71,528 KB
testcase_06 AC 92 ms
71,168 KB
testcase_07 AC 93 ms
71,432 KB
testcase_08 AC 92 ms
71,484 KB
testcase_09 AC 92 ms
71,244 KB
testcase_10 AC 92 ms
71,520 KB
testcase_11 AC 90 ms
71,276 KB
testcase_12 AC 93 ms
71,492 KB
testcase_13 AC 97 ms
72,084 KB
testcase_14 AC 254 ms
83,280 KB
testcase_15 AC 158 ms
83,420 KB
testcase_16 AC 241 ms
82,384 KB
testcase_17 AC 237 ms
82,496 KB
testcase_18 AC 234 ms
82,292 KB
testcase_19 AC 236 ms
82,384 KB
testcase_20 AC 141 ms
78,332 KB
testcase_21 AC 130 ms
80,052 KB
testcase_22 AC 140 ms
78,172 KB
testcase_23 AC 144 ms
78,492 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())
dat = [[0] * W for _ in range(H)]
for _ in range(N):
    x,y = map(int,input().split())
    dat[x-1][y-1] = 1
dp = [[-1] * W for _ in range(H)]
dp[0][0] = 0
#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 dp[x + i][y + j] == -1:
                stack.append((x + i,y + j))
            t = dp[x][y] + dat[x + i][y + j]
            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