結果

問題 No.2230 Good Omen of White Lotus
ユーザー 👑 hitonanodehitonanode
提出日時 2023-02-24 22:13:37
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 167 ms / 2,000 ms
コード長 609 bytes
コンパイル時間 5,930 ms
コンパイル使用メモリ 313,264 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2023-10-11 06:22:56
合計ジャッジ時間 10,662 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 1 ms
4,352 KB
testcase_04 AC 2 ms
4,352 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 2 ms
4,352 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 1 ms
4,352 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 62 ms
4,348 KB
testcase_15 AC 2 ms
4,352 KB
testcase_16 AC 92 ms
4,632 KB
testcase_17 AC 92 ms
4,652 KB
testcase_18 AC 93 ms
4,632 KB
testcase_19 AC 92 ms
4,628 KB
testcase_20 AC 8 ms
4,352 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 9 ms
4,348 KB
testcase_23 AC 10 ms
4,352 KB
testcase_24 AC 4 ms
5,972 KB
testcase_25 AC 5 ms
5,964 KB
testcase_26 AC 4 ms
5,972 KB
testcase_27 AC 100 ms
7,648 KB
testcase_28 AC 131 ms
7,716 KB
testcase_29 AC 117 ms
7,552 KB
testcase_30 AC 143 ms
7,712 KB
testcase_31 AC 140 ms
7,484 KB
testcase_32 AC 138 ms
7,532 KB
testcase_33 AC 162 ms
7,528 KB
testcase_34 AC 163 ms
7,644 KB
testcase_35 AC 163 ms
7,552 KB
testcase_36 AC 163 ms
7,556 KB
testcase_37 AC 163 ms
7,532 KB
testcase_38 AC 163 ms
7,536 KB
testcase_39 AC 167 ms
7,544 KB
testcase_40 AC 51 ms
6,236 KB
testcase_41 AC 48 ms
4,912 KB
testcase_42 AC 102 ms
4,740 KB
testcase_43 AC 10 ms
5,972 KB
testcase_44 AC 136 ms
5,936 KB
testcase_45 AC 52 ms
4,900 KB
testcase_46 AC 86 ms
6,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0