結果

問題 No.2230 Good Omen of White Lotus
ユーザー titiatitia
提出日時 2023-03-19 04:57:18
言語 PyPy3
(7.3.8)
結果
WA  
実行時間 -
コード長 1,166 bytes
コンパイル時間 307 ms
使用メモリ 110,004 KB
最終ジャッジ日時 2023-03-19 04:57:40
合計ジャッジ時間 17,256 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 76 ms
79,800 KB
testcase_01 AC 79 ms
79,900 KB
testcase_02 AC 70 ms
79,932 KB
testcase_03 AC 66 ms
79,872 KB
testcase_04 AC 67 ms
79,592 KB
testcase_05 AC 65 ms
79,704 KB
testcase_06 AC 68 ms
79,896 KB
testcase_07 AC 66 ms
79,876 KB
testcase_08 AC 66 ms
79,864 KB
testcase_09 AC 67 ms
79,972 KB
testcase_10 AC 70 ms
79,864 KB
testcase_11 AC 67 ms
79,704 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 465 ms
108,244 KB
testcase_17 AC 467 ms
108,064 KB
testcase_18 AC 499 ms
108,180 KB
testcase_19 AC 470 ms
108,232 KB
testcase_20 AC 161 ms
88,864 KB
testcase_21 AC 131 ms
87,560 KB
testcase_22 AC 168 ms
89,076 KB
testcase_23 AC 196 ms
89,280 KB
testcase_24 AC 66 ms
80,016 KB
testcase_25 AC 68 ms
79,812 KB
testcase_26 AC 66 ms
79,876 KB
testcase_27 AC 420 ms
110,004 KB
testcase_28 AC 442 ms
108,000 KB
testcase_29 AC 489 ms
108,244 KB
testcase_30 AC 459 ms
107,988 KB
testcase_31 AC 478 ms
107,892 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