結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
57,676 KB
testcase_01 AC 40 ms
57,676 KB
testcase_02 AC 39 ms
57,676 KB
testcase_03 AC 39 ms
57,676 KB
testcase_04 AC 39 ms
57,676 KB
testcase_05 AC 39 ms
57,676 KB
testcase_06 AC 39 ms
57,676 KB
testcase_07 AC 39 ms
57,676 KB
testcase_08 AC 40 ms
57,676 KB
testcase_09 AC 39 ms
57,676 KB
testcase_10 AC 39 ms
57,676 KB
testcase_11 AC 40 ms
57,676 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 335 ms
101,340 KB
testcase_17 AC 334 ms
101,352 KB
testcase_18 AC 342 ms
101,336 KB
testcase_19 AC 340 ms
101,340 KB
testcase_20 AC 114 ms
81,972 KB
testcase_21 AC 95 ms
80,556 KB
testcase_22 AC 117 ms
82,544 KB
testcase_23 AC 122 ms
82,552 KB
testcase_24 AC 38 ms
57,676 KB
testcase_25 AC 38 ms
57,676 KB
testcase_26 AC 39 ms
57,676 KB
testcase_27 AC 312 ms
104,772 KB
testcase_28 AC 316 ms
101,036 KB
testcase_29 AC 358 ms
101,128 KB
testcase_30 AC 347 ms
101,240 KB
testcase_31 AC 364 ms
101,304 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