結果

問題 No.2683 Two Sheets
ユーザー SnowBeenDidingSnowBeenDiding
提出日時 2024-03-21 00:30:57
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 631 bytes
コンパイル時間 5,155 ms
コンパイル使用メモリ 308,992 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2024-03-21 00:31:03
合計ジャッジ時間 5,957 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 AC 2 ms
6,548 KB
testcase_02 AC 2 ms
6,548 KB
testcase_03 AC 2 ms
6,548 KB
testcase_04 AC 2 ms
6,548 KB
testcase_05 AC 2 ms
6,548 KB
testcase_06 AC 2 ms
6,548 KB
testcase_07 AC 3 ms
6,548 KB
testcase_08 AC 2 ms
6,548 KB
testcase_09 AC 2 ms
6,548 KB
testcase_10 AC 2 ms
6,548 KB
testcase_11 AC 2 ms
6,548 KB
testcase_12 AC 2 ms
6,548 KB
testcase_13 AC 2 ms
6,548 KB
testcase_14 AC 2 ms
6,548 KB
testcase_15 AC 2 ms
6,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#include <atcoder/all>
#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
using namespace std;
using namespace atcoder;

using mint = modint998244353;

int g(int n, int l) {
    if (n < l) return 0;
    if (n - l + 1 < 0) return 0;
    return n - l + 1;
}

mint f(int n, int l) {
    mint ret = 0;
    rep(i, 1, l) { ret += (mint)g(n, 2 * l - i) * 2 * i; }
    ret += (mint)g(n, l) * l;
    ret /= g(n, l);
    ret /= g(n, l);
    return ret;
}

int main() {
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    mint ans = (mint)a * b * 2 - f(h, a) * f(w, b);
    cout << ans.val() << endl;
}
0