結果

問題 No.1043 直列大学
ユーザー wattaiheiwattaihei
提出日時 2020-05-01 22:20:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 219 ms / 2,000 ms
コード長 732 bytes
コンパイル時間 571 ms
コンパイル使用メモリ 87,248 KB
実行使用メモリ 80,460 KB
最終ジャッジ日時 2023-08-24 05:47:23
合計ジャッジ時間 5,496 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,352 KB
testcase_01 AC 77 ms
71,228 KB
testcase_02 AC 77 ms
71,156 KB
testcase_03 AC 76 ms
71,396 KB
testcase_04 AC 76 ms
71,324 KB
testcase_05 AC 74 ms
71,428 KB
testcase_06 AC 73 ms
71,436 KB
testcase_07 AC 75 ms
71,456 KB
testcase_08 AC 75 ms
71,304 KB
testcase_09 AC 91 ms
76,228 KB
testcase_10 AC 97 ms
76,972 KB
testcase_11 AC 136 ms
78,008 KB
testcase_12 AC 219 ms
80,460 KB
testcase_13 AC 143 ms
78,688 KB
testcase_14 AC 146 ms
78,392 KB
testcase_15 AC 155 ms
78,568 KB
testcase_16 AC 146 ms
78,540 KB
testcase_17 AC 119 ms
78,100 KB
testcase_18 AC 121 ms
78,908 KB
testcase_19 AC 139 ms
78,652 KB
testcase_20 AC 115 ms
77,748 KB
testcase_21 AC 136 ms
78,532 KB
testcase_22 AC 142 ms
79,480 KB
testcase_23 AC 162 ms
78,732 KB
testcase_24 AC 127 ms
78,316 KB
testcase_25 AC 141 ms
78,576 KB
testcase_26 AC 144 ms
78,660 KB
testcase_27 AC 100 ms
76,932 KB
testcase_28 AC 116 ms
77,732 KB
testcase_29 AC 85 ms
76,332 KB
testcase_30 AC 132 ms
77,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from bisect import bisect_left
mod = 10**9+7

N, M = map(int, input().split())
V = list(map(int, input().split()))
R = list(map(int, input().split()))
A, B = map(int, input().split())

Lv = sum(V)
dp1 = [0]*(Lv+1)
dp1[0] = 1
for v in V:
    for t in reversed(range(Lv+1-v)):
        dp1[t+v] = (dp1[t+v] + dp1[t]) % mod

Lr = sum(R)
dp2 = [0]*(Lr+1)
dp2[0] = 1
for r in R:
    for t in reversed(range(Lr+1-r)):
        dp2[t+r] = (dp2[t+r] + dp2[t]) % mod

dp3 = [0]*(Lv+1)
dp3[0] = dp1[0]
for n in range(Lv):
    dp3[n+1] = (dp3[n] + dp1[n+1]) % mod

ans = 0
for c in range(1, Lr+1):
    score = dp2[c] * (dp3[min(c*B, Lv)] - dp3[min(c*A-1, Lv)]) % mod
    ans = (ans + score) % mod
print(ans)
0