結果
問題 | No.2001 Distanced Triple |
ユーザー | ygd. |
提出日時 | 2022-07-09 11:24:01 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,105 bytes |
コンパイル時間 | 1,248 ms |
コンパイル使用メモリ | 86,788 KB |
実行使用メモリ | 71,444 KB |
最終ジャッジ日時 | 2023-08-28 21:59:14 |
合計ジャッジ時間 | 5,314 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 73 ms
71,308 KB |
testcase_01 | AC | 73 ms
71,320 KB |
testcase_02 | WA | - |
testcase_03 | AC | 73 ms
71,308 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 75 ms
71,128 KB |
testcase_07 | WA | - |
testcase_08 | AC | 74 ms
71,204 KB |
testcase_09 | AC | 73 ms
71,216 KB |
testcase_10 | WA | - |
testcase_11 | AC | 74 ms
71,392 KB |
testcase_12 | AC | 71 ms
71,192 KB |
testcase_13 | AC | 72 ms
71,300 KB |
testcase_14 | AC | 74 ms
71,220 KB |
testcase_15 | AC | 72 ms
71,204 KB |
testcase_16 | AC | 73 ms
71,188 KB |
testcase_17 | AC | 72 ms
71,188 KB |
testcase_18 | AC | 74 ms
71,368 KB |
testcase_19 | AC | 74 ms
71,400 KB |
testcase_20 | AC | 73 ms
71,064 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 75 ms
71,180 KB |
testcase_24 | AC | 74 ms
71,380 KB |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | AC | 73 ms
71,192 KB |
testcase_30 | AC | 73 ms
70,944 KB |
testcase_31 | WA | - |
testcase_32 | WA | - |
ソースコード
import sys #input = sys.stdin.readline #input = sys.stdin.buffer.readline #文字列はダメ #sys.setrecursionlimit(1000000) #import bisect #import itertools #import random #from heapq import heapify, heappop, heappush #from collections import defaultdict #from collections import deque #import copy #import math #from functools import lru_cache #@lru_cache(maxsize=None) #MOD = pow(10,9) + 7 MOD = 998244353 #dx = [1,0,-1,0] #dy = [0,1,0,-1] #dx8 = [1,1,0,-1,-1,-1,0,1] #dy8 = [0,1,1,1,0,-1,-1,-1] inv2 = pow(2,MOD-2,MOD) inv6 = pow(6,MOD-2,MOD) def sumk(a): return a*(a+1)%MOD*inv2%MOD def sumk2(a): return a*(a+1)%MOD*(2*a+1)%MOD*inv6%MOD def main(): L,R = map(int,input().split()) A,B,C = map(int,input().split()) btm = max(A+B,C) top = R - L if btm > top: print(0);exit() beta = top + 1 alpha = 1 - (B+A) #print(top,btm) ans = 0 ans -= sumk2(top) - sumk2(btm-1) ans += (beta - alpha) * (sumk(top) - sumk2(btm-1)) %MOD ans += alpha * beta %MOD * (top - btm + 1) %MOD print(ans%MOD) if __name__ == '__main__': main()