結果

問題 No.1043 直列大学
ユーザー kohei2019kohei2019
提出日時 2022-07-14 00:25:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 394 ms / 2,000 ms
コード長 794 bytes
コンパイル時間 484 ms
コンパイル使用メモリ 86,864 KB
実行使用メモリ 236,848 KB
最終ジャッジ日時 2023-09-07 11:32:13
合計ジャッジ時間 9,797 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
84,716 KB
testcase_01 AC 89 ms
79,360 KB
testcase_02 AC 111 ms
87,796 KB
testcase_03 AC 87 ms
79,144 KB
testcase_04 AC 88 ms
79,204 KB
testcase_05 AC 93 ms
81,012 KB
testcase_06 AC 96 ms
80,756 KB
testcase_07 AC 99 ms
82,412 KB
testcase_08 AC 102 ms
84,136 KB
testcase_09 AC 251 ms
158,324 KB
testcase_10 AC 275 ms
174,000 KB
testcase_11 AC 365 ms
223,472 KB
testcase_12 AC 394 ms
236,720 KB
testcase_13 AC 341 ms
210,116 KB
testcase_14 AC 358 ms
217,972 KB
testcase_15 AC 375 ms
231,240 KB
testcase_16 AC 351 ms
214,792 KB
testcase_17 AC 284 ms
177,964 KB
testcase_18 AC 287 ms
179,456 KB
testcase_19 AC 340 ms
208,412 KB
testcase_20 AC 289 ms
177,276 KB
testcase_21 AC 323 ms
198,376 KB
testcase_22 AC 339 ms
203,896 KB
testcase_23 AC 388 ms
236,848 KB
testcase_24 AC 303 ms
188,056 KB
testcase_25 AC 342 ms
208,572 KB
testcase_26 AC 360 ms
217,948 KB
testcase_27 AC 224 ms
147,456 KB
testcase_28 AC 339 ms
208,384 KB
testcase_29 AC 183 ms
120,620 KB
testcase_30 AC 285 ms
176,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
lsV = list(map(int,input().split()))
lsR = list(map(int,input().split()))
A,B = map(int,input().split())
mod = 10**9+7
dpV = [0]*(10**5+2)
dpV[0] = 1
for j in range(N):
    dpV2 = dpV[:]
    for i in range(10**5+1):    
        if i + lsV[j] <= 10**5:
            dpV2[i + lsV[j]] += dpV[i]
            dpV2[i + lsV[j]] %= mod
    dpV = dpV2

dpR = [0]*(10**5+1)
dpR[0] = 1
for j in range(M):
    dpR2 = dpR[:]
    for i in range(10**5+1):    
        if i + lsR[j] <= 10**5:
            dpR2[i + lsR[j]] += dpR[i]
            dpR2[i + lsR[j]] %= mod
    dpR = dpR2


for i in range(1,10**5+2):
    dpV[i] += dpV[i-1]
    dpV[i] %= mod
ans = 0
for j in range(1,10**5+1):
    ans += dpR[j]*(dpV[min(10**5+1,B*j)]-dpV[min(10**5+1,A*j-1)])
    ans %= mod
print(ans)
0