結果

問題 No.1043 直列大学
ユーザー ronpooronpoo
提出日時 2023-09-06 14:06:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 421 ms / 2,000 ms
コード長 847 bytes
コンパイル時間 2,682 ms
コンパイル使用メモリ 86,884 KB
実行使用メモリ 116,844 KB
最終ジャッジ日時 2023-09-06 14:07:00
合計ジャッジ時間 8,772 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
83,620 KB
testcase_01 AC 89 ms
83,624 KB
testcase_02 AC 94 ms
83,748 KB
testcase_03 AC 91 ms
83,580 KB
testcase_04 AC 90 ms
83,408 KB
testcase_05 AC 92 ms
83,596 KB
testcase_06 AC 87 ms
83,552 KB
testcase_07 AC 93 ms
83,492 KB
testcase_08 AC 92 ms
83,648 KB
testcase_09 AC 147 ms
83,848 KB
testcase_10 AC 166 ms
87,844 KB
testcase_11 AC 258 ms
85,468 KB
testcase_12 AC 421 ms
116,844 KB
testcase_13 AC 267 ms
91,992 KB
testcase_14 AC 286 ms
91,912 KB
testcase_15 AC 350 ms
98,620 KB
testcase_16 AC 279 ms
96,788 KB
testcase_17 AC 165 ms
84,016 KB
testcase_18 AC 191 ms
91,624 KB
testcase_19 AC 275 ms
98,048 KB
testcase_20 AC 169 ms
88,696 KB
testcase_21 AC 261 ms
99,764 KB
testcase_22 AC 246 ms
90,676 KB
testcase_23 AC 417 ms
111,196 KB
testcase_24 AC 191 ms
86,884 KB
testcase_25 AC 249 ms
89,968 KB
testcase_26 AC 293 ms
93,224 KB
testcase_27 AC 146 ms
85,500 KB
testcase_28 AC 234 ms
90,556 KB
testcase_29 AC 114 ms
83,852 KB
testcase_30 AC 260 ms
96,144 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

dpv = [0] * (10**5+1)
dpv[0] = 1
for i in range(N):
    for j in range(10**5, -1, -1):
        if V[i] + j <= 10**5 and dpv[j] > 0:
            dpv[V[i]+j] += dpv[j]
            

dpr = [0] * (10**5+1)
dpr[0] = 1
for i in range(M):
    for j in range(10**5, -1, -1):
        if R[i] + j <= 10**5 and dpr[j] > 0:
            dpr[R[i]+j] += dpr[j]
            

accv = [0]
for i in range(10**5):
    accv.append(accv[i] + dpv[i+1])
    
ans = 0
for i in range(1, len(dpr)):
    if dpr[i] == 0:
        continue
    low = max(0, A * i - 1)
    hig = min(B * i, 10**5)
    if low > hig:
        continue
    num = (accv[hig] - accv[low]) * dpr[i]
    ans += (num % MOD)
    ans %= MOD

print(ans)
0