結果

問題 No.2730 Two Types Luggage
ユーザー hiro1729hiro1729
提出日時 2024-03-14 17:35:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,809 ms / 2,000 ms
コード長 431 bytes
コンパイル時間 377 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 266,188 KB
最終ジャッジ日時 2024-03-14 17:36:03
合計ジャッジ時間 18,359 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,332 KB
testcase_01 AC 36 ms
53,332 KB
testcase_02 AC 77 ms
75,408 KB
testcase_03 AC 35 ms
53,332 KB
testcase_04 AC 1,760 ms
76,716 KB
testcase_05 AC 515 ms
76,712 KB
testcase_06 AC 505 ms
76,712 KB
testcase_07 AC 795 ms
76,944 KB
testcase_08 AC 1,738 ms
76,716 KB
testcase_09 AC 36 ms
53,332 KB
testcase_10 AC 556 ms
260,044 KB
testcase_11 AC 468 ms
263,916 KB
testcase_12 AC 143 ms
104,220 KB
testcase_13 AC 249 ms
181,840 KB
testcase_14 AC 1,229 ms
266,188 KB
testcase_15 AC 228 ms
163,600 KB
testcase_16 AC 148 ms
116,348 KB
testcase_17 AC 344 ms
94,092 KB
testcase_18 AC 210 ms
112,096 KB
testcase_19 AC 176 ms
136,164 KB
testcase_20 AC 141 ms
113,800 KB
testcase_21 AC 171 ms
107,840 KB
testcase_22 AC 1,809 ms
103,896 KB
testcase_23 AC 805 ms
77,080 KB
testcase_24 AC 691 ms
257,156 KB
testcase_25 AC 440 ms
186,188 KB
testcase_26 AC 81 ms
91,656 KB
testcase_27 AC 360 ms
198,768 KB
testcase_28 AC 136 ms
106,816 KB
testcase_29 AC 421 ms
232,932 KB
testcase_30 AC 444 ms
257,784 KB
testcase_31 AC 219 ms
156,680 KB
testcase_32 AC 350 ms
240,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M, W = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse = True)
A_ac = [0]
for i in A:
	A_ac.append(A_ac[-1] + i)
ans = 0
for b in range(1 << M):
	B_sum = sum(B[i] for i in range(M) if b & (1 << i))
	C_sum = sum(C[i] for i in range(M) if b & (1 << i))
	if B_sum <= W:
		ans = max(ans, A_ac[min(N, W - B_sum)] + C_sum)
print(ans)
0