結果

問題 No.2329 Nafmo、イカサマをする
ユーザー lloyzlloyz
提出日時 2023-09-15 23:23:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 240 ms / 2,000 ms
コード長 612 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 87,292 KB
実行使用メモリ 140,564 KB
最終ジャッジ日時 2023-09-15 23:23:39
合計ジャッジ時間 6,913 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,328 KB
testcase_01 AC 72 ms
71,324 KB
testcase_02 AC 72 ms
71,252 KB
testcase_03 AC 76 ms
71,492 KB
testcase_04 AC 75 ms
71,496 KB
testcase_05 AC 73 ms
71,656 KB
testcase_06 AC 73 ms
71,324 KB
testcase_07 AC 74 ms
71,500 KB
testcase_08 AC 91 ms
76,464 KB
testcase_09 AC 72 ms
71,300 KB
testcase_10 AC 73 ms
71,136 KB
testcase_11 AC 77 ms
71,528 KB
testcase_12 AC 72 ms
71,320 KB
testcase_13 AC 75 ms
71,448 KB
testcase_14 AC 73 ms
71,432 KB
testcase_15 AC 74 ms
71,652 KB
testcase_16 AC 77 ms
71,448 KB
testcase_17 AC 74 ms
71,328 KB
testcase_18 AC 74 ms
71,420 KB
testcase_19 AC 85 ms
76,668 KB
testcase_20 AC 85 ms
77,060 KB
testcase_21 AC 79 ms
76,224 KB
testcase_22 AC 82 ms
76,288 KB
testcase_23 AC 75 ms
71,320 KB
testcase_24 AC 71 ms
71,408 KB
testcase_25 AC 75 ms
76,040 KB
testcase_26 AC 74 ms
71,488 KB
testcase_27 AC 74 ms
71,304 KB
testcase_28 AC 73 ms
71,660 KB
testcase_29 AC 92 ms
76,968 KB
testcase_30 AC 76 ms
71,476 KB
testcase_31 AC 74 ms
71,300 KB
testcase_32 AC 73 ms
71,324 KB
testcase_33 AC 73 ms
71,660 KB
testcase_34 AC 74 ms
71,324 KB
testcase_35 AC 86 ms
76,248 KB
testcase_36 AC 150 ms
105,576 KB
testcase_37 AC 77 ms
76,024 KB
testcase_38 AC 73 ms
71,468 KB
testcase_39 AC 160 ms
108,420 KB
testcase_40 AC 92 ms
76,100 KB
testcase_41 AC 240 ms
140,564 KB
testcase_42 AC 87 ms
76,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_right

n, m, k = map(int, input().split())
A = list(map(int, input().split()))

A.sort()
A = [0] + A
k1 = k // 2
B1 = set([0])
for _ in range(k1):
    NB1 = set()
    for b in B1:
        for a in A:
            NB1.add(b + a)
    B1 = NB1
k2 = k - k1
B2 = set([0])
for _ in range(k2):
    NB2 = set()
    for b in B2:
        for a in A:
            NB2.add(b + a)
    B2 = NB2

B1 = sorted(B1)
B2 = sorted(B2)
nn = len(B1)
ans = 0
for i in range(nn):
    res = m - B1[i]
    if res < 0:
        break
    idx = bisect_right(B2, res)
    ans = max(ans, B1[i] + B2[idx - 1])
print(ans)
0