結果

問題 No.1043 直列大学
ユーザー tikitaka1201tikitaka1201
提出日時 2020-07-08 23:03:35
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 885 bytes
コンパイル時間 310 ms
コンパイル使用メモリ 81,880 KB
実行使用メモリ 242,420 KB
最終ジャッジ日時 2024-04-15 08:19:48
合計ジャッジ時間 11,585 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 66 ms
74,404 KB
testcase_02 AC 98 ms
85,976 KB
testcase_03 AC 71 ms
74,504 KB
testcase_04 AC 65 ms
73,556 KB
testcase_05 AC 79 ms
76,956 KB
testcase_06 AC 77 ms
76,628 KB
testcase_07 AC 84 ms
79,688 KB
testcase_08 AC 89 ms
80,036 KB
testcase_09 AC 312 ms
160,140 KB
testcase_10 AC 348 ms
177,104 KB
testcase_11 RE -
testcase_12 AC 522 ms
239,740 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 RE -
testcase_29 RE -
testcase_30 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=map(int,input().split())
*v,=map(int,input().split())
*r,=map(int,input().split())
sr=sum(r)
sv=sum(v)

a,b=map(int,input().split())
mod=10**9+7
dpv=[[0]*(100*1000+1) for _ in range(n+1)]
dpv[0][0]=1
dpr=[[0]*(100*1000+1) for _ in range(m+1)]
dpr[0][0]=1

for i in range(1,n+1):
    dpv[i][0]=1
    for j in range(100*1000+1):
        dpv[i][j]=dpv[i-1][j]
        if 0<=j-v[i-1]<=100*1000:
            dpv[i][j]+=dpv[i-1][j-v[i-1]]
        dpv[i][j]%=mod

for i in range(1,m+1):
    dpr[i][0]=1
    for j in range(100*1000+1):
        dpr[i][j]=dpr[i-1][j]
        if 0<=j-r[i-1]<=100*1000:
            dpr[i][j]+=dpr[i-1][j-r[i-1]]
        dpr[i][j]%=mod

dpv=dpv[-1]
dpv[0]=0
from itertools import accumulate
dpvacc=list(accumulate(dpv))

dpr=dpr[-1]


ans=0
for R in range(1, 100*1000+1):
    ans+=(dpr[R]*(dpvacc[min(100*1000,b*R)]-dpvacc[a*R-1]))%mod
    ans%=mod

print(ans)
0