結果

問題 No.2230 Good Omen of White Lotus
ユーザー ああいいああいい
提出日時 2023-02-25 17:48:47
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 784 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 835,568 KB
最終ジャッジ日時 2023-10-11 15:02:48
合計ジャッジ時間 8,013 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,572 KB
testcase_01 AC 90 ms
71,576 KB
testcase_02 AC 92 ms
71,400 KB
testcase_03 AC 91 ms
71,564 KB
testcase_04 AC 91 ms
71,348 KB
testcase_05 AC 93 ms
71,592 KB
testcase_06 AC 91 ms
71,460 KB
testcase_07 AC 93 ms
71,656 KB
testcase_08 AC 91 ms
71,252 KB
testcase_09 AC 94 ms
71,404 KB
testcase_10 AC 91 ms
71,540 KB
testcase_11 AC 92 ms
71,380 KB
testcase_12 AC 95 ms
71,580 KB
testcase_13 AC 102 ms
72,040 KB
testcase_14 AC 304 ms
91,740 KB
testcase_15 AC 178 ms
81,032 KB
testcase_16 AC 355 ms
99,256 KB
testcase_17 AC 367 ms
99,048 KB
testcase_18 AC 358 ms
99,272 KB
testcase_19 AC 359 ms
99,408 KB
testcase_20 AC 157 ms
79,708 KB
testcase_21 AC 132 ms
80,152 KB
testcase_22 AC 157 ms
80,320 KB
testcase_23 AC 155 ms
80,392 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 = [[-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))
            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