結果
問題 |
No.2683 Two Sheets
|
ユーザー |
![]() |
提出日時 | 2024-03-21 00:54:50 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 34 ms / 2,000 ms |
コード長 | 779 bytes |
コンパイル時間 | 1,815 ms |
コンパイル使用メモリ | 196,072 KB |
最終ジャッジ日時 | 2025-02-20 10:21:35 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/modint> using namespace std; using mint = atcoder::modint998244353; void fast_io() { ios::sync_with_stdio(false); std::cin.tie(nullptr); } int main() { fast_io(); long long h, w, a, b; cin >> h >> w >> a >> b; mint x = 0, y = 0; for (int i = 1; i <= min(a - 1, h - a + 1); i++) { x += mint(a - i) * 2 * (h - a - i + 1); } for (int i = 1; i <= min(b - 1, w - b + 1); i++) { y += mint(b - i) * 2 * (w - b - i + 1); } x += (h - a + 1) * a; y += (w - b + 1) * b; // cout << x.val() << " " << y.val() << endl; x /= (h - a + 1); x /= (h - a + 1); y /= (w - b + 1); y /= (w - b + 1); mint ans = mint(2 * a * b) - x * y; cout << ans.val() << endl; }