結果
問題 | No.2230 Good Omen of White Lotus |
ユーザー |
![]() |
提出日時 | 2023-02-24 22:13:37 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 175 ms / 2,000 ms |
コード長 | 609 bytes |
コンパイル時間 | 5,881 ms |
コンパイル使用メモリ | 316,452 KB |
実行使用メモリ | 7,680 KB |
最終ジャッジ日時 | 2024-09-13 05:36:41 |
合計ジャッジ時間 | 9,858 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 44 |
ソースコード
#include <bits/stdc++.h>using namespace std;#include <atcoder/all>using mint = atcoder::modint998244353;int op(int l, int r) { return std::max(l, r); }int e() { return 0; }int main() {int H, W, N, P;cin >> H >> W >> N >> P;vector<pair<int, int>> xy(N);for (auto &[x, y] : xy) cin >> x >> y, --y;sort(xy.begin(), xy.end());atcoder::segtree<int, op, e> tree(W);for (auto [_, y] : xy) tree.set(y, tree.prod(0, y + 1) + 1);const int k = tree.all_prod();mint p = mint(1) / P;cout << (1 - (1 - p).pow(H + W - 3 - k) * (1 - p * 2).pow(k)).val() << endl;}