結果

問題 No.2001 Distanced Triple
ユーザー 👑 rin204rin204
提出日時 2022-09-19 01:47:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 375 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 87,036 KB
実行使用メモリ 71,624 KB
最終ジャッジ日時 2023-08-23 18:31:42
合計ジャッジ時間 4,604 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,352 KB
testcase_01 AC 68 ms
71,196 KB
testcase_02 AC 68 ms
71,280 KB
testcase_03 AC 66 ms
71,420 KB
testcase_04 AC 68 ms
71,236 KB
testcase_05 AC 68 ms
71,452 KB
testcase_06 WA -
testcase_07 AC 67 ms
71,308 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 68 ms
71,236 KB
testcase_11 AC 68 ms
71,296 KB
testcase_12 AC 68 ms
71,284 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 66 ms
71,244 KB
testcase_22 AC 68 ms
71,556 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 67 ms
71,264 KB
testcase_26 AC 66 ms
71,536 KB
testcase_27 AC 65 ms
71,428 KB
testcase_28 AC 66 ms
71,400 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 69 ms
71,224 KB
testcase_32 AC 65 ms
71,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353
l, r = map(int, input().split())
n = r - l
a, b, c = map(int, input().split())
c = max(c, a + b)
d = n - c + 1
e = c - (a + b) + 1
n -= c
ans = 0
ans -= n * (n + 1) * (2 * n + 1) // 6
ans += (d - e) * n * (n + 1) // 2
ans += d * e * (n + 1)
print(ans % MOD)
"""
for z in range(n - c + 1):
    ans += -z * z + (d - e) * z + d * e
    ans %= MOD
print(ans)
"""
0