結果

問題 No.2001 Distanced Triple
ユーザー Ricky_pon
提出日時 2022-07-09 11:23:03
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 380 bytes
コンパイル時間 576 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-12-30 11:40:23
合計ジャッジ時間 3,065 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 15
権限があれば一括ダウンロードができます

ソースコード

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