結果

問題 No.1043 直列大学
ユーザー ronpooronpoo
提出日時 2023-09-06 14:01:36
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 813 bytes
コンパイル時間 771 ms
コンパイル使用メモリ 87,248 KB
実行使用メモリ 117,028 KB
最終ジャッジ日時 2023-09-06 14:01:47
合計ジャッジ時間 9,260 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
83,580 KB
testcase_01 AC 88 ms
83,644 KB
testcase_02 AC 91 ms
83,576 KB
testcase_03 AC 93 ms
83,824 KB
testcase_04 AC 90 ms
83,416 KB
testcase_05 AC 91 ms
83,528 KB
testcase_06 AC 87 ms
83,416 KB
testcase_07 AC 91 ms
83,808 KB
testcase_08 AC 92 ms
83,580 KB
testcase_09 AC 145 ms
83,964 KB
testcase_10 AC 164 ms
87,612 KB
testcase_11 RE -
testcase_12 AC 438 ms
117,028 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 196 ms
91,448 KB
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 AC 148 ms
85,528 KB
testcase_28 AC 232 ms
90,076 KB
testcase_29 AC 118 ms
83,712 KB
testcase_30 AC 253 ms
95,964 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)
    num = (accv[hig] - accv[low]) * dpr[i]
    ans += (num % MOD)
    ans %= MOD

print(ans)
0