結果

問題 No.1043 直列大学
ユーザー nehan_der_thalnehan_der_thal
提出日時 2020-05-01 22:48:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 708 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 10,892 KB
実行使用メモリ 17,812 KB
最終ジャッジ日時 2023-08-26 15:31:19
合計ジャッジ時間 6,301 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
12,216 KB
testcase_01 AC 16 ms
8,280 KB
testcase_02 AC 15 ms
8,272 KB
testcase_03 AC 14 ms
8,260 KB
testcase_04 AC 15 ms
8,224 KB
testcase_05 AC 14 ms
8,156 KB
testcase_06 AC 13 ms
8,172 KB
testcase_07 AC 13 ms
8,220 KB
testcase_08 AC 13 ms
8,280 KB
testcase_09 AC 96 ms
8,468 KB
testcase_10 AC 253 ms
8,892 KB
testcase_11 AC 1,785 ms
10,968 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys;input=sys.stdin.readline
N, M = map(int, input().split())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))
A, B = map(int, input().split())
sx = sum(X)+1
sy = sum(Y)+1
V = [0]*sx
V[0] = 1
for i in range(N):
    x = X[i]
    for j in range(sx-1, -1, -1):
        if j-x>=0:
            V[j] += V[j-x]
R = [0]*sy
R[0] = 1
for i in range(M):
    x = Y[i]
    for j in range(sy-1, -1, -1):
        if j-x>=0:
            R[j] += R[j-x]

SV = [0]*(sx+1)
for i in range(1, sx+1):
    SV[i] = SV[i-1] + V[i-1]

mod = 1000000007
rr = 0
for i in range(1, sy):
    r = R[i]
    a, b = min(i*A, sx), min(i*B+1, sx)
    rr = (rr+(SV[b]-SV[a])*r) % mod
#print(SV)
#print(V, R)
print(rr)
0