結果

問題 No.2683 Two Sheets
ユーザー rlangevinrlangevin
提出日時 2024-03-25 12:15:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 416 ms / 2,000 ms
コード長 288 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 75,136 KB
最終ジャッジ日時 2024-03-25 12:15:05
合計ジャッジ時間 5,117 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 35 ms
53,460 KB
testcase_02 AC 64 ms
74,880 KB
testcase_03 AC 365 ms
74,880 KB
testcase_04 AC 116 ms
75,136 KB
testcase_05 AC 314 ms
75,008 KB
testcase_06 AC 285 ms
75,008 KB
testcase_07 AC 241 ms
74,880 KB
testcase_08 AC 416 ms
74,880 KB
testcase_09 AC 251 ms
74,880 KB
testcase_10 AC 400 ms
75,008 KB
testcase_11 AC 379 ms
75,008 KB
testcase_12 AC 300 ms
74,880 KB
testcase_13 AC 41 ms
59,476 KB
testcase_14 AC 231 ms
74,892 KB
testcase_15 AC 311 ms
74,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(x, N):
    v = 0
    inv = pow(N - x + 1, mod - 2, mod)
    for i in range(1, N + 1):
        v += (min(i, x, N - x + 1, N - i + 1) * inv) ** 2
        v %= mod
    return v

H, W, A, B = map(int, input().split())
mod = 998244353
ans = 2 * A * B - f(A, H) * f(B, W)
print(ans % mod)
0