結果

問題 No.2230 Good Omen of White Lotus
ユーザー titiatitia
提出日時 2023-03-19 05:00:49
言語 PyPy3
(7.3.11)
結果
AC  
実行時間 1,070 ms / 2,000 ms
コード長 1,175 bytes
コンパイル時間 388 ms
コンパイル使用メモリ 86,936 KB
実行使用メモリ 106,356 KB
最終ジャッジ日時 2023-07-18 14:23:47
合計ジャッジ時間 19,441 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
75,304 KB
testcase_01 AC 76 ms
75,320 KB
testcase_02 AC 76 ms
75,336 KB
testcase_03 AC 76 ms
75,336 KB
testcase_04 AC 76 ms
75,340 KB
testcase_05 AC 76 ms
75,232 KB
testcase_06 AC 77 ms
75,596 KB
testcase_07 AC 75 ms
75,224 KB
testcase_08 AC 76 ms
75,192 KB
testcase_09 AC 75 ms
75,340 KB
testcase_10 AC 76 ms
75,412 KB
testcase_11 AC 77 ms
75,572 KB
testcase_12 AC 78 ms
75,272 KB
testcase_13 AC 84 ms
79,752 KB
testcase_14 AC 375 ms
94,976 KB
testcase_15 AC 94 ms
80,104 KB
testcase_16 AC 381 ms
102,828 KB
testcase_17 AC 383 ms
102,808 KB
testcase_18 AC 390 ms
102,996 KB
testcase_19 AC 382 ms
102,932 KB
testcase_20 AC 152 ms
83,636 KB
testcase_21 AC 125 ms
81,908 KB
testcase_22 AC 151 ms
83,376 KB
testcase_23 AC 160 ms
83,988 KB
testcase_24 AC 76 ms
75,188 KB
testcase_25 AC 77 ms
75,392 KB
testcase_26 AC 77 ms
75,580 KB
testcase_27 AC 349 ms
106,356 KB
testcase_28 AC 360 ms
102,780 KB
testcase_29 AC 405 ms
102,420 KB
testcase_30 AC 394 ms
102,392 KB
testcase_31 AC 397 ms
102,620 KB
testcase_32 AC 388 ms
102,472 KB
testcase_33 AC 1,056 ms
104,464 KB
testcase_34 AC 1,030 ms
104,140 KB
testcase_35 AC 1,031 ms
104,360 KB
testcase_36 AC 1,024 ms
104,040 KB
testcase_37 AC 1,009 ms
104,528 KB
testcase_38 AC 1,013 ms
104,192 KB
testcase_39 AC 1,070 ms
103,836 KB
testcase_40 AC 370 ms
88,512 KB
testcase_41 AC 366 ms
88,996 KB
testcase_42 AC 686 ms
96,916 KB
testcase_43 AC 148 ms
82,556 KB
testcase_44 AC 909 ms
101,676 KB
testcase_45 AC 385 ms
89,496 KB
testcase_46 AC 567 ms
94,008 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