結果

問題 No.2230 Good Omen of White Lotus
ユーザー ああいいああいい
提出日時 2023-02-25 17:45:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 800 bytes
コンパイル時間 1,096 ms
コンパイル使用メモリ 87,236 KB
実行使用メモリ 830,888 KB
最終ジャッジ日時 2023-10-11 15:00:12
合計ジャッジ時間 9,392 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,308 KB
testcase_01 AC 74 ms
71,264 KB
testcase_02 WA -
testcase_03 AC 73 ms
71,128 KB
testcase_04 AC 73 ms
71,136 KB
testcase_05 AC 72 ms
71,420 KB
testcase_06 AC 73 ms
71,120 KB
testcase_07 AC 73 ms
71,244 KB
testcase_08 WA -
testcase_09 AC 73 ms
71,332 KB
testcase_10 WA -
testcase_11 AC 72 ms
71,300 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 142 ms
80,848 KB
testcase_16 AC 342 ms
98,428 KB
testcase_17 AC 334 ms
98,464 KB
testcase_18 AC 337 ms
98,540 KB
testcase_19 AC 345 ms
98,228 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
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)]
stack = [(0,0)]
while stack:
    x,y = stack.pop()
    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
if H == 1 or W == 1:
    v += 1
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