結果

問題 No.2001 Distanced Triple
ユーザー Ricky_ponRicky_pon
提出日時 2022-07-09 11:23:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 380 bytes
コンパイル時間 372 ms
コンパイル使用メモリ 10,776 KB
実行使用メモリ 8,032 KB
最終ジャッジ日時 2023-08-28 21:59:09
合計ジャッジ時間 2,225 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,888 KB
testcase_01 AC 16 ms
7,880 KB
testcase_02 AC 15 ms
8,004 KB
testcase_03 AC 15 ms
7,760 KB
testcase_04 AC 15 ms
7,820 KB
testcase_05 AC 16 ms
7,864 KB
testcase_06 WA -
testcase_07 AC 15 ms
7,884 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 16 ms
7,808 KB
testcase_11 AC 16 ms
7,796 KB
testcase_12 AC 15 ms
7,952 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 15 ms
7,840 KB
testcase_22 AC 16 ms
7,780 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 15 ms
7,856 KB
testcase_26 AC 15 ms
7,868 KB
testcase_27 AC 16 ms
7,764 KB
testcase_28 AC 15 ms
7,948 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 16 ms
7,848 KB
testcase_32 AC 16 ms
7,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(P, Q, R):
    return (R*(R+1)*(2*R+1)//6 + (P+Q)*R*(R+1)//2+ P*Q*R) // 2

L, R = map(int, input().split())
A, B, C = map(int, input().split())

if C >= B+A:
    ans = f(C-L-2*A-2*B+2, -C-L+1, R) - f(C-L-2*A-2*B+2, -C-L+1, L+C-1)
    ans %= 998244353
    print(ans)
else:
    ans = f(-B-L-A+1, -B-L-A+2, R) - f(-B-L-A+1, -B-L-A+2, L+A+B-1)
    ans %= 998244353
    print(ans)
0