結果
| 問題 |
No.2230 Good Omen of White Lotus
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-03-07 12:09:00 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 91 ms / 2,000 ms |
| コード長 | 804 bytes |
| コンパイル時間 | 3,843 ms |
| コンパイル使用メモリ | 285,400 KB |
| 実行使用メモリ | 8,612 KB |
| 最終ジャッジ日時 | 2025-03-07 12:09:10 |
| 合計ジャッジ時間 | 9,557 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 44 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/segtree>
#include <atcoder/modint>
using namespace std;
using ll = long long;
using mint = atcoder::modint998244353;
int op(int a, int b) { return max(a, b); }
int e() { return 0; }
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int H, W, N, P;
cin >> H >> W >> N >> P;
vector<pair<int, int>> I(N);
for(auto&[x, y]: I) cin >> x >> y;
sort(I.begin(), I.end());
const int M = 2e5 + 10;
atcoder::segtree<int, op, e> seg(M);
for(int i = 0; i < N; i++) {
const auto&[x, y] = I[i];
seg.set(y, seg.prod(0, y + 1) + 1);
}
int cnt = seg.all_prod();
mint ans = 1;
const mint invP = mint::raw(P).inv();
ans *= (1 - invP * 2).pow(cnt);
ans *= (1 - invP).pow(H + W - 3 - cnt);
ans = 1 - ans;
cout << ans.val() << endl;
}