結果

問題 No.2683 Two Sheets
ユーザー kokoseikokosei
提出日時 2024-03-20 23:29:50
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 724 bytes
コンパイル時間 2,938 ms
コンパイル使用メモリ 248,312 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2024-03-20 23:29:55
合計ジャッジ時間 3,613 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 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 15 ms
6,548 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 3 ms
6,548 KB
testcase_13 WA -
testcase_14 AC 3 ms
6,548 KB
testcase_15 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using ll = long long;
using mint = atcoder::modint998244353;

int H, W, A, B;
int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    cin >> H >> W >> A >> B;
    mint s1h = 0, s2h = 0, s1w = 0, s2w = 0;
    for(int i = 1;i <= H;i++){
        mint v = min({A, i, H - i + 1});
        s1h += v;
        s2h += v * v;
    }
    for(int i = 1;i <= W;i++){
        mint v = min({B, i, W - i + 1});
        s1w += v;
        s2w += v * v;
    }
    mint q = (ll)(H - A + 1) * (W - B + 1);
    mint w = s2h * s2w - 2 * q * s1h * s1w + q * q * H * W;
    mint ans = (ll)H * W - w / q / q;
    cout << ans.val() << endl;
    return 0;
}
0