結果

問題 No.1043 直列大学
ユーザー AEnAEn
提出日時 2022-05-20 10:53:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 835 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 81,832 KB
実行使用メモリ 408,444 KB
最終ジャッジ日時 2023-10-19 22:19:58
合計ジャッジ時間 13,630 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
73,280 KB
testcase_01 AC 51 ms
69,432 KB
testcase_02 AC 67 ms
78,016 KB
testcase_03 AC 50 ms
69,432 KB
testcase_04 AC 51 ms
69,432 KB
testcase_05 AC 51 ms
69,432 KB
testcase_06 AC 51 ms
69,432 KB
testcase_07 AC 62 ms
74,880 KB
testcase_08 AC 63 ms
74,880 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 RE -
testcase_12 WA -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 WA -
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 204 ms
143,984 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

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())

dp = [[0]*(10**5+1) for _ in range(N)]
dp1 = [[0]*(10**5+1) for _ in range(M)]
dp[0][0] = 1;dp[0][V[0]] = 1
dp1[0][0] = 1;dp1[0][R[0]] = 1
for i in range(1, N):
    for j in range(10**5+1):
        dp[i][j] += dp[i-1][j] 
        if dp[i-1][j] > 0:
            dp[i][j+V[i]] += dp[i-1][j]
for i in range(1, M):
    for j in range(10**5+1):
        dp1[i][j] += dp1[i-1][j] 
        if dp1[i-1][j] > 0:
            dp1[i][j+R[i]] += dp1[i-1][j]
from itertools import accumulate
VV = list(accumulate(dp[-1]))
res = 0
mod = 10**9+7
for i in range(1,len(dp1[-1])):
    if dp1[-1][i] > 0 and A*dp1[-1][i]<=10**5:
        res += (VV[min(10**5, B*i)] - VV[A*i-1])*dp1[-1][i]
        res %= mod
print(res)
0