結果

問題 No.1043 直列大学
ユーザー konchanksukonchanksu
提出日時 2020-05-02 18:00:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 752 bytes
コンパイル時間 130 ms
コンパイル使用メモリ 10,928 KB
実行使用メモリ 20,988 KB
最終ジャッジ日時 2023-08-29 01:22:41
合計ジャッジ時間 29,249 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
10,564 KB
testcase_01 AC 68 ms
10,588 KB
testcase_02 AC 68 ms
10,540 KB
testcase_03 AC 64 ms
10,636 KB
testcase_04 AC 65 ms
10,648 KB
testcase_05 AC 62 ms
10,576 KB
testcase_06 AC 65 ms
10,500 KB
testcase_07 AC 63 ms
10,544 KB
testcase_08 AC 62 ms
10,680 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 TLE -
testcase_13 WA -
testcase_14 AC 1,720 ms
19,276 KB
testcase_15 TLE -
testcase_16 AC 1,593 ms
19,300 KB
testcase_17 AC 911 ms
17,836 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 TLE -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 540 ms
15,380 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())

ans = 0

dpr = [0 for i in range(10 ** 5 + 1)]
dpv = [0 for i in range(10 ** 5 + 1)]
dpr[0] = 1
dpv[0] = 1

for i in range(M):
    for j in range(10 ** 3 * i, -1, -1):
        if dpr[j]:
            dpr[j + R[i]] += dpr[j]

for i in range(N):
    for j in range(10 ** 3 * i, -1, -1):
        if dpv[j]:
            dpv[j + V[i]] += dpv[j]

dpv[0] = 0
S = [0 for i in range(10 ** 5 + 1)]

for i in range(1, 10 ** 5 + 1):
    S[i] += S[i - 1] + dpv[i]

for i in range(1, 10 ** 5 + 1):
    if not dpr[i]:
        continue
    ans += (S[min(B * i, 10 ** 5)] - S[min(A * i - 1, 10 ** 5)]) * dpr[i]

print(ans)
        
0