結果

問題 No.2683 Two Sheets
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2023-12-14 20:48:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 452 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 67,864 KB
最終ジャッジ日時 2023-12-14 20:53:21
合計ジャッジ時間 1,715 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 43 ms
59,576 KB
testcase_03 AC 47 ms
65,816 KB
testcase_04 AC 45 ms
61,712 KB
testcase_05 AC 45 ms
61,720 KB
testcase_06 AC 45 ms
61,708 KB
testcase_07 AC 42 ms
59,448 KB
testcase_08 AC 52 ms
67,864 KB
testcase_09 AC 41 ms
59,448 KB
testcase_10 AC 49 ms
65,828 KB
testcase_11 AC 47 ms
63,768 KB
testcase_12 AC 49 ms
65,816 KB
testcase_13 AC 37 ms
53,460 KB
testcase_14 AC 43 ms
59,448 KB
testcase_15 AC 42 ms
59,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353

def solve(H,A):

    ret = 0
    for i in range(H-A+1):

        Lmin = max(1,A-i)
        Rmin = max(1,(i+A)-(H-A) )

        ret += (Lmin+A)*(A-Lmin+1)//2 + (Rmin+A)*(A-Rmin+1)//2 - A
        ret %= mod
    
    ret *= pow( (H-A+1)**2 , mod-2 , mod )
    return ret % mod


H,W,A,B = map(int,input().split())

assert 1 <= A <= H <= 2*(10**5)
assert 1 <= B <= W <= 2*(10**5)

ans = (2*A*B - solve(H,A) * solve(W,B)) % mod
print (ans)
0