結果

問題 No.1043 直列大学
ユーザー kohei2019kohei2019
提出日時 2022-07-14 00:23:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 793 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 87,016 KB
実行使用メモリ 236,848 KB
最終ジャッジ日時 2023-09-07 11:30:49
合計ジャッジ時間 10,756 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
84,640 KB
testcase_01 AC 87 ms
79,400 KB
testcase_02 AC 108 ms
87,656 KB
testcase_03 AC 85 ms
79,204 KB
testcase_04 AC 88 ms
79,444 KB
testcase_05 AC 92 ms
80,884 KB
testcase_06 AC 90 ms
80,876 KB
testcase_07 AC 102 ms
82,516 KB
testcase_08 AC 102 ms
84,132 KB
testcase_09 AC 250 ms
158,320 KB
testcase_10 WA -
testcase_11 AC 358 ms
219,532 KB
testcase_12 AC 395 ms
236,848 KB
testcase_13 RE -
testcase_14 AC 331 ms
202,280 KB
testcase_15 RE -
testcase_16 AC 349 ms
213,260 KB
testcase_17 AC 258 ms
166,184 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 WA -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 390 ms
236,848 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 178 ms
120,820 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 RE -
権限があれば一括ダウンロードができます

ソースコード

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(N):
    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