結果

問題 No.2230 Good Omen of White Lotus
ユーザー ニックネームニックネーム
提出日時 2023-02-24 23:33:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 935 ms / 2,000 ms
コード長 521 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 87,300 KB
実行使用メモリ 100,184 KB
最終ジャッジ日時 2023-10-11 07:00:31
合計ジャッジ時間 17,735 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,376 KB
testcase_01 AC 71 ms
71,444 KB
testcase_02 AC 73 ms
71,444 KB
testcase_03 AC 74 ms
71,272 KB
testcase_04 AC 73 ms
71,372 KB
testcase_05 AC 72 ms
71,456 KB
testcase_06 AC 73 ms
71,468 KB
testcase_07 AC 72 ms
71,508 KB
testcase_08 AC 73 ms
71,340 KB
testcase_09 AC 72 ms
71,500 KB
testcase_10 AC 73 ms
71,476 KB
testcase_11 AC 72 ms
71,384 KB
testcase_12 AC 73 ms
71,268 KB
testcase_13 AC 77 ms
71,476 KB
testcase_14 AC 330 ms
89,616 KB
testcase_15 AC 87 ms
76,296 KB
testcase_16 AC 330 ms
97,000 KB
testcase_17 AC 337 ms
96,704 KB
testcase_18 AC 338 ms
96,808 KB
testcase_19 AC 333 ms
96,876 KB
testcase_20 AC 126 ms
78,636 KB
testcase_21 AC 111 ms
78,188 KB
testcase_22 AC 133 ms
79,248 KB
testcase_23 AC 134 ms
79,808 KB
testcase_24 AC 73 ms
73,016 KB
testcase_25 AC 74 ms
72,988 KB
testcase_26 AC 75 ms
72,740 KB
testcase_27 AC 321 ms
98,208 KB
testcase_28 AC 313 ms
98,304 KB
testcase_29 AC 338 ms
97,976 KB
testcase_30 AC 344 ms
98,480 KB
testcase_31 AC 341 ms
98,088 KB
testcase_32 AC 330 ms
98,256 KB
testcase_33 AC 923 ms
100,100 KB
testcase_34 AC 908 ms
99,192 KB
testcase_35 AC 913 ms
99,832 KB
testcase_36 AC 935 ms
99,524 KB
testcase_37 AC 911 ms
100,184 KB
testcase_38 AC 921 ms
99,380 KB
testcase_39 AC 914 ms
99,188 KB
testcase_40 AC 315 ms
84,816 KB
testcase_41 AC 315 ms
84,192 KB
testcase_42 AC 612 ms
91,604 KB
testcase_43 AC 132 ms
79,436 KB
testcase_44 AC 794 ms
96,136 KB
testcase_45 AC 331 ms
84,808 KB
testcase_46 AC 516 ms
89,620 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

class BIT:
    def __init__(self, n):
        self.n = n; self.k = [0]*(n+1)
    def u(self, i, x):
        while i <= self.n: self.k[i] = max(self.k[i], x); i += i&-i
    def m(self, i):
        t = 0
        while i > 0: t = max(t, self.k[i]); i -= i&-i
        return t
h,w,n,p = map(int,input().split())
xy = [tuple(map(int,input().split())) for _ in range(n)]
m = 998244353; bit = BIT(w+1)
for x,y in sorted(xy): bit.u(y,bit.m(y)+1)
c = bit.m(w)
print((1-pow(p-1,h+w-3-c,m)*pow(p-2,c,m)*pow(pow(p,h+w-3,m),m-2,m))%m)
0