結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 243 ms
10,696 KB
testcase_01 AC 206 ms
10,756 KB
testcase_02 AC 370 ms
10,652 KB
testcase_03 AC 206 ms
10,664 KB
testcase_04 AC 202 ms
10,604 KB
testcase_05 AC 206 ms
10,636 KB
testcase_06 AC 202 ms
10,640 KB
testcase_07 AC 280 ms
10,624 KB
testcase_08 AC 282 ms
10,644 KB
testcase_09 TLE -
testcase_10 TLE -
testcase_11 TLE -
testcase_12 -- -
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 #

n, m = map(int, input().split())
vs = list(map(int, input().split()))
rs = list(map(int, input().split()))
a, b = map(int, input().split())
v_sum = [0 for _ in range(100001)]
v_sum[0] = 1
r_sum = [0 for _ in range(100001)]
r_sum[0] = 1
for v in vs:
	for i in range(100000, v-1, -1):
		v_sum[i] += v_sum[i-v]
for r in rs:
	for i in range(100000, r-1, -1):
		r_sum[i] += r_sum[i-r]

v_cum = [1 for _ in range(100001)]
for i in range(1, 100001):
	v_cum[i] = v_cum[i-1] + v_sum[i]

MOD = 10**9+7
ans = 0
for i in range(1, 100001):
	x, y = min(a*i-1, 100000), min(b*i, 100000)
	num = v_cum[y] - v_cum[x]
	ans += num * r_sum[i]
	ans %= MOD
print(ans)
0