結果

問題 No.2230 Good Omen of White Lotus
ユーザー 👑 rin204rin204
提出日時 2023-03-06 00:23:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 588 ms / 2,000 ms
コード長 450 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 81,672 KB
実行使用メモリ 104,212 KB
最終ジャッジ日時 2023-10-18 05:02:43
合計ジャッジ時間 14,760 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,432 KB
testcase_01 AC 39 ms
53,432 KB
testcase_02 AC 37 ms
53,432 KB
testcase_03 AC 39 ms
53,432 KB
testcase_04 AC 38 ms
53,432 KB
testcase_05 AC 37 ms
53,432 KB
testcase_06 AC 37 ms
53,432 KB
testcase_07 AC 38 ms
53,432 KB
testcase_08 AC 39 ms
53,432 KB
testcase_09 AC 40 ms
53,432 KB
testcase_10 AC 37 ms
53,432 KB
testcase_11 AC 38 ms
53,432 KB
testcase_12 AC 38 ms
53,432 KB
testcase_13 AC 40 ms
53,432 KB
testcase_14 AC 248 ms
89,104 KB
testcase_15 AC 45 ms
55,488 KB
testcase_16 AC 300 ms
96,848 KB
testcase_17 AC 302 ms
96,848 KB
testcase_18 AC 299 ms
96,848 KB
testcase_19 AC 298 ms
96,848 KB
testcase_20 AC 95 ms
76,852 KB
testcase_21 AC 76 ms
73,684 KB
testcase_22 AC 99 ms
77,972 KB
testcase_23 AC 102 ms
78,180 KB
testcase_24 AC 38 ms
53,440 KB
testcase_25 AC 38 ms
53,440 KB
testcase_26 AC 38 ms
53,440 KB
testcase_27 AC 285 ms
104,092 KB
testcase_28 AC 284 ms
103,784 KB
testcase_29 AC 284 ms
104,036 KB
testcase_30 AC 290 ms
103,784 KB
testcase_31 AC 289 ms
104,212 KB
testcase_32 AC 268 ms
96,752 KB
testcase_33 AC 588 ms
98,356 KB
testcase_34 AC 575 ms
97,604 KB
testcase_35 AC 574 ms
98,092 KB
testcase_36 AC 579 ms
97,828 KB
testcase_37 AC 566 ms
98,352 KB
testcase_38 AC 582 ms
97,828 KB
testcase_39 AC 571 ms
97,828 KB
testcase_40 AC 226 ms
84,560 KB
testcase_41 AC 228 ms
84,152 KB
testcase_42 AC 405 ms
94,092 KB
testcase_43 AC 96 ms
76,804 KB
testcase_44 AC 505 ms
95,268 KB
testcase_45 AC 225 ms
83,252 KB
testcase_46 AC 327 ms
87,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_right

MOD = 998244353

h, w, n, P = map(int, input().split())
xy = [list(map(int, input().split())) for _ in range(n)]
xy.sort(key=lambda x:(x[0] << 30) + x[1])

lst = []
for _, y in xy:
    p = bisect_right(lst, y)
    if len(lst) == p:
        lst.append(y)
    else:
        lst[p] = y

inv = pow(P, MOD - 2, MOD)
x = len(lst)
y = h + w - 3 - x
ans = 1 - pow(1 - inv, y, MOD) * pow(1 - 2 * inv, x, MOD)
print(ans % MOD)
0