結果

問題 No.2230 Good Omen of White Lotus
ユーザー 沙耶花沙耶花
提出日時 2023-02-24 22:20:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 164 ms / 2,000 ms
コード長 794 bytes
コンパイル時間 4,473 ms
コンパイル使用メモリ 264,352 KB
実行使用メモリ 10,124 KB
最終ジャッジ日時 2023-10-11 06:26:39
合計ジャッジ時間 9,571 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
8,328 KB
testcase_01 AC 5 ms
8,312 KB
testcase_02 AC 5 ms
8,328 KB
testcase_03 AC 5 ms
8,424 KB
testcase_04 AC 6 ms
8,216 KB
testcase_05 AC 5 ms
8,400 KB
testcase_06 AC 5 ms
8,344 KB
testcase_07 AC 5 ms
8,356 KB
testcase_08 AC 6 ms
8,220 KB
testcase_09 AC 5 ms
8,288 KB
testcase_10 AC 5 ms
8,260 KB
testcase_11 AC 5 ms
8,276 KB
testcase_12 AC 5 ms
8,328 KB
testcase_13 AC 6 ms
8,288 KB
testcase_14 AC 69 ms
9,276 KB
testcase_15 AC 6 ms
8,276 KB
testcase_16 AC 102 ms
9,844 KB
testcase_17 AC 104 ms
9,944 KB
testcase_18 AC 103 ms
9,856 KB
testcase_19 AC 102 ms
9,892 KB
testcase_20 AC 11 ms
8,576 KB
testcase_21 AC 6 ms
8,364 KB
testcase_22 AC 14 ms
8,484 KB
testcase_23 AC 14 ms
8,636 KB
testcase_24 AC 5 ms
8,344 KB
testcase_25 AC 5 ms
8,460 KB
testcase_26 AC 5 ms
8,536 KB
testcase_27 AC 102 ms
9,848 KB
testcase_28 AC 130 ms
9,868 KB
testcase_29 AC 119 ms
9,960 KB
testcase_30 AC 146 ms
9,848 KB
testcase_31 AC 140 ms
9,844 KB
testcase_32 AC 138 ms
9,952 KB
testcase_33 AC 159 ms
9,800 KB
testcase_34 AC 159 ms
9,912 KB
testcase_35 AC 159 ms
10,012 KB
testcase_36 AC 159 ms
9,944 KB
testcase_37 AC 158 ms
10,124 KB
testcase_38 AC 164 ms
9,808 KB
testcase_39 AC 160 ms
9,796 KB
testcase_40 AC 51 ms
8,744 KB
testcase_41 AC 49 ms
8,952 KB
testcase_42 AC 103 ms
9,316 KB
testcase_43 AC 10 ms
8,560 KB
testcase_44 AC 136 ms
9,728 KB
testcase_45 AC 53 ms
9,108 KB
testcase_46 AC 85 ms
9,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001

int op(int a,int b){
	return max(a,b);
}
int e(){
	return 0;
}

int main(){
	
	int H,W,N,P;
	cin>>H>>W>>N>>P;
	
	vector<pair<int,int>> x(N);
	rep(i,N){
		cin>>x[i].first>>x[i].second;
	}
	sort(x.begin(),x.end());
	segtree<int,op,e> seg(300000);
	rep(i,N){
		int y = x[i].second;
		seg.set(y,max(seg.get(y),seg.prod(0,y+1)+1));
	}
	
	int V = seg.all_prod();
	//cout<<V<<endl;
	int num = H+W-3;
	mint ans = 1;
	ans *= mint(P-2).pow(V);;
	ans *= mint(P-1).pow(num-V);
	ans /= mint(P).pow(num);
	ans = 1-ans;
	cout<<ans.val()<<endl;
	
	return 0;
}
0