結果
問題 | No.1043 直列大学 |
ユーザー | 👑 Kazun |
提出日時 | 2021-04-14 02:11:22 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 717 bytes |
コンパイル時間 | 274 ms |
コンパイル使用メモリ | 86,628 KB |
実行使用メモリ | 80,792 KB |
最終ジャッジ日時 | 2023-09-12 15:38:18 |
合計ジャッジ時間 | 7,232 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 72 ms
71,116 KB |
testcase_01 | AC | 72 ms
71,048 KB |
testcase_02 | AC | 73 ms
71,180 KB |
testcase_03 | AC | 73 ms
71,064 KB |
testcase_04 | AC | 75 ms
71,244 KB |
testcase_05 | AC | 73 ms
71,160 KB |
testcase_06 | AC | 74 ms
71,056 KB |
testcase_07 | AC | 72 ms
71,240 KB |
testcase_08 | RE | - |
testcase_09 | AC | 88 ms
76,068 KB |
testcase_10 | AC | 84 ms
76,056 KB |
testcase_11 | RE | - |
testcase_12 | AC | 159 ms
79,468 KB |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | RE | - |
testcase_28 | AC | 96 ms
76,760 KB |
testcase_29 | AC | 80 ms
75,740 KB |
testcase_30 | AC | 106 ms
76,976 KB |
ソースコード
def Subsum_Count(L): L_sum=sum(L) X=[0]*(L_sum+1) X[0]=1 for x in L: for a in range(L_sum,x-1,-1): X[a]+=X[a-x] X[a]%=Mod return X N,M=map(int,input().split()) V=list(map(int,input().split())) R=list(map(int,input().split())) A,B=map(int,input().split()) Mod=10**9+7 V_sum=sum(V) X=Subsum_Count(V) R_sum=sum(R) Y=Subsum_Count(R) X_accum=[0]*len(X) X_accum[0]=X[0] for i in range(1,len(X)): X_accum[i]=X_accum[i-1]+X[i] X_accum[i]%=Mod Ans=0 for r in range(1,R_sum+1): left =max(r*A,0) right=min(r*B,V_sum) if left==0: Ans+=Y[r]*X_accum[right] else: Ans+=Y[r]*(X_accum[right]-X_accum[left-1]) Ans%=Mod print(Ans)