結果

問題 No.1043 直列大学
ユーザー uni_pythonuni_python
提出日時 2020-06-21 18:05:12
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 990 bytes
コンパイル時間 643 ms
コンパイル使用メモリ 87,228 KB
実行使用メモリ 132,292 KB
最終ジャッジ日時 2023-09-16 18:32:56
合計ジャッジ時間 6,920 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
76,076 KB
testcase_01 AC 70 ms
71,408 KB
testcase_02 AC 77 ms
76,052 KB
testcase_03 AC 72 ms
71,612 KB
testcase_04 AC 68 ms
71,300 KB
testcase_05 AC 70 ms
71,280 KB
testcase_06 AC 71 ms
71,608 KB
testcase_07 AC 78 ms
75,776 KB
testcase_08 AC 74 ms
75,920 KB
testcase_09 AC 96 ms
77,204 KB
testcase_10 WA -
testcase_11 AC 218 ms
90,612 KB
testcase_12 AC 369 ms
132,292 KB
testcase_13 RE -
testcase_14 AC 156 ms
82,108 KB
testcase_15 RE -
testcase_16 AC 206 ms
93,748 KB
testcase_17 AC 98 ms
77,132 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 WA -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 346 ms
114,684 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 90 ms
76,452 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 RE -
権限があれば一括ダウンロードができます

ソースコード

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]
            
    dpr=[0]*N2
    #dp[i][j]はi番目まで見て,抵抗の総和がj.使いまわしてiを無視
    dpr[0]=1
    
    for i in range(N):
        r=R[i]
        for j in range(N2-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,N2):
        temp=S[min(N2,B*r+1)]-S[min(N2,A*r)]
        ans=(ans+temp*dpr[r])%mod
        
        
    print((ans)%mod)

    


main()
0