結果

問題 No.2230 Good Omen of White Lotus
ユーザー titiatitia
提出日時 2023-03-19 05:00:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,111 ms / 2,000 ms
コード長 1,175 bytes
コンパイル時間 348 ms
コンパイル使用メモリ 81,824 KB
実行使用メモリ 104,704 KB
最終ジャッジ日時 2023-10-18 17:40:46
合計ジャッジ時間 18,566 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
57,608 KB
testcase_01 AC 40 ms
57,608 KB
testcase_02 AC 40 ms
57,608 KB
testcase_03 AC 41 ms
57,608 KB
testcase_04 AC 40 ms
57,608 KB
testcase_05 AC 41 ms
57,608 KB
testcase_06 AC 40 ms
57,608 KB
testcase_07 AC 40 ms
57,608 KB
testcase_08 AC 40 ms
57,608 KB
testcase_09 AC 40 ms
57,608 KB
testcase_10 AC 40 ms
57,608 KB
testcase_11 AC 40 ms
57,608 KB
testcase_12 AC 42 ms
57,608 KB
testcase_13 AC 51 ms
65,772 KB
testcase_14 AC 359 ms
93,560 KB
testcase_15 AC 62 ms
70,040 KB
testcase_16 AC 370 ms
101,156 KB
testcase_17 AC 365 ms
101,160 KB
testcase_18 AC 365 ms
101,152 KB
testcase_19 AC 370 ms
101,160 KB
testcase_20 AC 121 ms
81,816 KB
testcase_21 AC 95 ms
80,576 KB
testcase_22 AC 125 ms
82,280 KB
testcase_23 AC 130 ms
82,472 KB
testcase_24 AC 40 ms
57,608 KB
testcase_25 AC 40 ms
57,608 KB
testcase_26 AC 40 ms
57,608 KB
testcase_27 AC 334 ms
104,704 KB
testcase_28 AC 346 ms
100,972 KB
testcase_29 AC 390 ms
101,136 KB
testcase_30 AC 379 ms
101,056 KB
testcase_31 AC 391 ms
101,140 KB
testcase_32 AC 372 ms
101,044 KB
testcase_33 AC 1,094 ms
103,012 KB
testcase_34 AC 1,093 ms
102,596 KB
testcase_35 AC 1,107 ms
103,000 KB
testcase_36 AC 1,111 ms
102,636 KB
testcase_37 AC 1,106 ms
103,008 KB
testcase_38 AC 1,105 ms
102,740 KB
testcase_39 AC 1,107 ms
102,604 KB
testcase_40 AC 359 ms
87,256 KB
testcase_41 AC 358 ms
87,288 KB
testcase_42 AC 702 ms
95,488 KB
testcase_43 AC 122 ms
81,200 KB
testcase_44 AC 942 ms
99,788 KB
testcase_45 AC 385 ms
87,932 KB
testcase_46 AC 594 ms
92,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=998244353

H,W,N,Px=map(int,input().split())
P=[list(map(int,input().split())) for i in range(N)]

# Segment tree(1-indexed,再帰を使わないもの)

def seg_function(x,y): # Segment treeで扱うfunction
    return max(x,y)

LEN=202000
seg_el=1<<(LEN.bit_length()) # Segment treeの台の要素数
SEG=[0]*(2*seg_el) # 1-indexedなので、要素数2*seg_el.Segment treeの初期値で初期化


def update(n,x,seg_el): # A[n]をxへ更新
    i=n+seg_el
    SEG[i]=x
    i>>=1 # 子ノードへ
    
    while i!=0:
        SEG[i]=seg_function(SEG[i*2],SEG[i*2+1])
        i>>=1
        
def getvalues(l,r): # 区間[l,r)に関するseg_functionを調べる
    L=l+seg_el
    R=r+seg_el
    ANS=0

    while L<R:
        if L & 1:
            ANS=seg_function(ANS , SEG[L])
            L+=1

        if R & 1:
            R-=1
            ANS=seg_function(ANS , SEG[R])
        L>>=1
        R>>=1

    return ANS

P.sort()
for x,y in P:
    MAX=getvalues(0,y+1)
    update(y,MAX+1,seg_el)
    
ANS=getvalues(0,LEN)
idou=H-1+W-2
nokori=idou-ANS

# (1-2/P)**ANS*(1-1/P)**nokori

INV=pow(Px,mod-2,mod)

print((1-pow((1-2*INV),ANS,mod)*pow((1-INV),nokori,mod))%mod)
0