結果

問題 No.1043 直列大学
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-03-24 23:55:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 152 ms / 2,000 ms
コード長 791 bytes
コンパイル時間 1,184 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 68,352 KB
最終ジャッジ日時 2024-04-21 08:46:41
合計ジャッジ時間 5,397 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
62,208 KB
testcase_01 AC 49 ms
61,696 KB
testcase_02 AC 54 ms
62,652 KB
testcase_03 AC 51 ms
61,696 KB
testcase_04 AC 50 ms
61,696 KB
testcase_05 AC 50 ms
61,696 KB
testcase_06 AC 49 ms
61,440 KB
testcase_07 AC 52 ms
62,592 KB
testcase_08 AC 51 ms
62,336 KB
testcase_09 AC 86 ms
65,280 KB
testcase_10 AC 95 ms
65,024 KB
testcase_11 AC 128 ms
66,560 KB
testcase_12 AC 152 ms
65,792 KB
testcase_13 AC 130 ms
66,688 KB
testcase_14 AC 140 ms
66,100 KB
testcase_15 AC 137 ms
65,408 KB
testcase_16 AC 126 ms
64,896 KB
testcase_17 AC 104 ms
64,512 KB
testcase_18 AC 108 ms
66,944 KB
testcase_19 AC 134 ms
68,352 KB
testcase_20 AC 109 ms
66,816 KB
testcase_21 AC 127 ms
66,432 KB
testcase_22 AC 123 ms
65,280 KB
testcase_23 AC 143 ms
65,792 KB
testcase_24 AC 111 ms
65,664 KB
testcase_25 AC 133 ms
65,664 KB
testcase_26 AC 140 ms
66,944 KB
testcase_27 AC 94 ms
64,384 KB
testcase_28 AC 125 ms
65,664 KB
testcase_29 AC 74 ms
65,536 KB
testcase_30 AC 107 ms
65,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
V = list(map(int,input().split()))
R = list(map(int,input().split()))
a,b = map(int,input().split())
mod = 10**9+7

M = 10**5+5
dpV = [0]*M
dpR = [0]*M
dpV[0] = 1
dpR[0] = 1

for v in V:
    for i in range(M)[::-1]:
        if dpV[i] == 0:
            continue
        dpV[i+v] += dpV[i]
        dpV[i+v] %= mod
    
for r in R:
    for i in range(M)[::-1]:
        if dpR[i] == 0:
            continue
        dpR[i+r] += dpR[i]
        dpR[i+r] %= mod

cumR = [0]*M
for i in range(M):
    cumR[i] = cumR[i-1]+dpR[i]
    cumR[i] %= mod

ans = 0
for i in range(1,M):
    if dpV[i] == 0:
        continue
    r = i//a
    l = (i+b-1)//b

    if r == 0:
        continue
    count = cumR[r]-cumR[max(l-1,0)]

    ans += dpV[i]*count%mod
    ans %= mod
print(ans)
0