結果

問題 No.1043 直列大学
ユーザー uni_pythonuni_python
提出日時 2020-06-21 18:09:59
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,008 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 132,372 KB
最終ジャッジ日時 2023-09-16 18:33:21
合計ジャッジ時間 6,810 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
75,812 KB
testcase_01 AC 73 ms
71,336 KB
testcase_02 AC 82 ms
75,744 KB
testcase_03 AC 74 ms
71,292 KB
testcase_04 AC 74 ms
71,424 KB
testcase_05 AC 74 ms
71,456 KB
testcase_06 AC 76 ms
71,312 KB
testcase_07 AC 83 ms
75,824 KB
testcase_08 AC 84 ms
76,028 KB
testcase_09 AC 102 ms
77,208 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 380 ms
132,372 KB
testcase_13 AC 225 ms
95,512 KB
testcase_14 RE -
testcase_15 AC 316 ms
112,880 KB
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 128 ms
81,956 KB
testcase_19 AC 221 ms
98,988 KB
testcase_20 RE -
testcase_21 AC 203 ms
91,116 KB
testcase_22 AC 204 ms
95,860 KB
testcase_23 AC 339 ms
114,468 KB
testcase_24 AC 145 ms
84,448 KB
testcase_25 AC 197 ms
91,484 KB
testcase_26 AC 259 ms
102,996 KB
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 197 ms
97,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
mod=10**9+7

def main():
    N,M=MI()
    V=LI()
    R=LI()
    A,B=MI()
    
    N2=(1000*N+1)
    dp=[0]*N2
    #dp[i][j]はi番目まで見て,電圧の総和がj.使いまわしてiを無視
    
    dp[0]=1
    for i in range(N):
        v=V[i]
        for j in range(N2-1-v,-1,-1):
            dp[j+v]+=dp[j]
            
    M2=(1000*M+1)
    dpr=[0]*N2
    #dp[i][j]はi番目まで見て,抵抗の総和がj.使いまわしてiを無視
    dpr[0]=1
    
    for i in range(M):
        r=R[i]
        for j in range(M2-1-r,-1,-1):
            dpr[j+r]+=dpr[j]
            
    S=[0]*(N2+1)
    #累積和
    
    for i in range(N2):
        S[i+1]=S[i]+dp[i]

    
    ans=0
    for r in range(1,M2):
        temp=S[min(N2,B*r+1)]-S[min(N2,A*r)]
        ans=(ans+temp*dpr[r])%mod
        
        
    print((ans)%mod)

    


main()
0