結果
| 問題 |
No.2683 Two Sheets
|
| コンテスト | |
| ユーザー |
tute7627
|
| 提出日時 | 2024-03-03 18:24:39 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 64 ms / 2,000 ms |
| コード長 | 791 bytes |
| コンパイル時間 | 2,052 ms |
| コンパイル使用メモリ | 196,184 KB |
| 最終ジャッジ日時 | 2025-02-20 00:16:44 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 |
ソースコード
#include<bits/stdc++.h>
#include<atcoder/modint>
using namespace std;
#ifdef LOCAL
#include <debug_print.hpp>
#define OUT(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#define OUT(...) (static_cast<void>(0))
#endif
int main(){
int H, W, A, B;
cin >> H >> W >> A >> B;
assert(1 <= H && H <= 2e5);
assert(1 <= W && W <= 2e5);
using modint = atcoder::modint998244353;
modint xs = 0, ys = 0;
for(int x = 0; x < H; x++){
modint prob = modint(max<int>(x - A + 1, 0) + max<int>(0, H - A - x)) / (H - A + 1);
xs += (1 - prob) * (1 - prob);
}
for(int y = 0; y < W; y++){
modint prob = modint(max<int>(y - B + 1, 0) + max<int>(0, W - B - y)) / (W - B + 1);
ys += (1 - prob) * (1 - prob);
}
cout << (modint(2) * A * B - xs * ys).val() << endl;
}
tute7627