結果

問題 No.1043 直列大学
ユーザー ronpooronpoo
提出日時 2023-09-06 13:58:49
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 793 bytes
コンパイル時間 416 ms
コンパイル使用メモリ 87,156 KB
実行使用メモリ 118,172 KB
最終ジャッジ日時 2023-09-06 13:59:00
合計ジャッジ時間 8,902 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
83,976 KB
testcase_01 AC 72 ms
83,884 KB
testcase_02 AC 79 ms
83,820 KB
testcase_03 AC 77 ms
83,804 KB
testcase_04 AC 75 ms
83,996 KB
testcase_05 AC 77 ms
83,920 KB
testcase_06 AC 75 ms
83,912 KB
testcase_07 AC 92 ms
83,944 KB
testcase_08 AC 78 ms
84,040 KB
testcase_09 AC 123 ms
84,284 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 AC 194 ms
85,616 KB
testcase_29 AC 98 ms
84,004 KB
testcase_30 AC 208 ms
96,404 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 = A * i - 1
    hig = B * i 
    num = (accv[hig] - accv[low]) * dpr[i]
    ans += (num % MOD)
    ans %= MOD

print(ans)
0