結果

問題 No.1043 直列大学
ユーザー 双六双六
提出日時 2020-08-20 20:35:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 254 ms / 2,000 ms
コード長 926 bytes
コンパイル時間 451 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 81,996 KB
最終ジャッジ日時 2023-08-24 12:53:47
合計ジャッジ時間 7,650 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
81,692 KB
testcase_01 AC 106 ms
78,752 KB
testcase_02 AC 117 ms
80,212 KB
testcase_03 AC 108 ms
78,696 KB
testcase_04 AC 106 ms
78,524 KB
testcase_05 AC 111 ms
80,260 KB
testcase_06 AC 111 ms
80,244 KB
testcase_07 AC 108 ms
78,708 KB
testcase_08 AC 110 ms
80,316 KB
testcase_09 AC 182 ms
80,136 KB
testcase_10 AC 194 ms
80,364 KB
testcase_11 AC 236 ms
80,264 KB
testcase_12 AC 248 ms
80,412 KB
testcase_13 AC 225 ms
80,248 KB
testcase_14 AC 232 ms
80,352 KB
testcase_15 AC 245 ms
80,116 KB
testcase_16 AC 229 ms
80,404 KB
testcase_17 AC 195 ms
80,200 KB
testcase_18 AC 203 ms
81,912 KB
testcase_19 AC 228 ms
81,988 KB
testcase_20 AC 198 ms
81,964 KB
testcase_21 AC 219 ms
81,996 KB
testcase_22 AC 228 ms
81,900 KB
testcase_23 AC 254 ms
81,772 KB
testcase_24 AC 213 ms
80,140 KB
testcase_25 AC 227 ms
80,048 KB
testcase_26 AC 235 ms
80,224 KB
testcase_27 AC 177 ms
81,784 KB
testcase_28 AC 228 ms
81,952 KB
testcase_29 AC 149 ms
81,940 KB
testcase_30 AC 200 ms
81,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N, M = getlist()
	V = getlist()
	R = getlist()
	A, B = getlist()
	
	DPv = [0] * (10 ** 5 + 1)
	DPv[0] = 1
	for i in range(N):
		for j in range(10 ** 5 + 1, -1, -1):
			if j + V[i] <= 10 ** 5:
				DPv[j + V[i]] += DPv[j]
				DPv[j + V[i]] %= con

	
	DPr = [0] * (10 ** 5 + 1)
	DPr[0] = 1
	for i in range(M):
		for j in range(10 ** 5 + 1, -1, -1):
			if j + R[i] <= 10 ** 5:
				DPr[j + R[i]] += DPr[j]
				DPr[j + R[i]] %= con

	# Vの累積
	for i in range(1, 10 ** 5 + 1):
		DPv[i] = (DPv[i - 1] + DPv[i]) % con

	ans = 0
	for i in range(1, 10 ** 5 + 1):
		ans += DPr[i] * (DPv[min(B * i, 10 ** 5)] - DPv[min(A * i - 1, 10 ** 5)])
		ans %= con

	print(ans)

if __name__ == '__main__':
	main()
0