結果

問題 No.2230 Good Omen of White Lotus
ユーザー titiatitia
提出日時 2023-03-19 04:57:18
言語 PyPy3
(7.3.11)
結果
WA  
実行時間 -
コード長 1,166 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 106,472 KB
最終ジャッジ日時 2023-07-18 14:23:26
合計ジャッジ時間 13,443 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
75,516 KB
testcase_01 AC 76 ms
75,668 KB
testcase_02 AC 76 ms
75,288 KB
testcase_03 AC 75 ms
75,356 KB
testcase_04 AC 73 ms
75,140 KB
testcase_05 AC 76 ms
75,440 KB
testcase_06 AC 75 ms
75,644 KB
testcase_07 AC 76 ms
75,344 KB
testcase_08 AC 74 ms
75,344 KB
testcase_09 AC 76 ms
75,348 KB
testcase_10 AC 77 ms
75,396 KB
testcase_11 AC 75 ms
75,516 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 352 ms
103,176 KB
testcase_17 AC 354 ms
103,176 KB
testcase_18 AC 353 ms
103,228 KB
testcase_19 AC 354 ms
103,236 KB
testcase_20 AC 142 ms
83,236 KB
testcase_21 AC 120 ms
81,812 KB
testcase_22 AC 148 ms
83,708 KB
testcase_23 AC 155 ms
84,584 KB
testcase_24 AC 74 ms
75,456 KB
testcase_25 AC 76 ms
75,644 KB
testcase_26 AC 74 ms
75,320 KB
testcase_27 AC 320 ms
106,472 KB
testcase_28 AC 333 ms
102,816 KB
testcase_29 AC 375 ms
102,520 KB
testcase_30 AC 368 ms
102,772 KB
testcase_31 AC 380 ms
103,004 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
権限があれば一括ダウンロードができます

ソースコード

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

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