結果

問題 No.2683 Two Sheets
ユーザー PNJPNJ
提出日時 2024-03-20 22:04:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 497 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 66,140 KB
最終ジャッジ日時 2024-03-20 22:05:03
合計ジャッジ時間 1,923 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,460 KB
testcase_01 AC 38 ms
53,460 KB
testcase_02 AC 48 ms
61,980 KB
testcase_03 AC 69 ms
66,140 KB
testcase_04 AC 60 ms
66,136 KB
testcase_05 AC 68 ms
64,056 KB
testcase_06 AC 64 ms
64,056 KB
testcase_07 AC 66 ms
66,140 KB
testcase_08 AC 72 ms
66,140 KB
testcase_09 AC 61 ms
64,056 KB
testcase_10 AC 71 ms
66,136 KB
testcase_11 AC 69 ms
64,056 KB
testcase_12 AC 67 ms
66,140 KB
testcase_13 AC 60 ms
59,708 KB
testcase_14 AC 61 ms
59,708 KB
testcase_15 AC 68 ms
66,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def Map():
  return list(map(int,input().split()))

mod = 998244353

H,W,A,B = Map()

p = 0
pp = 0
for h in range(H):
  l = max(0,h+1-A)
  r = min(h,H - A)
  x = r - l + 1
  p += x
  pp += pow(x,2,mod)
  p %= mod
  pp %= mod

q = 0
qq = 0
for w in range(W):
  l = max(0,w+1-B)
  r = min(w,W - B)
  x = r - l + 1
  q += x
  qq += pow(x,2,mod)
  q %= mod
  qq %= mod

n = (H - A + 1) * (W - B + 1) % mod
m = pow(n,2,mod)

C = 2*p*q*n
C %= mod
C -= pp*qq
C %= mod
C *= pow(m,-1,mod)
C %= mod
print(C)
0