結果

問題 No.2329 Nafmo、イカサマをする
ユーザー titiatitia
提出日時 2023-07-25 05:44:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 512 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 82,860 KB
実行使用メモリ 98,572 KB
最終ジャッジ日時 2024-04-09 23:23:21
合計ジャッジ時間 3,154 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
52,544 KB
testcase_01 AC 34 ms
53,148 KB
testcase_02 AC 33 ms
52,876 KB
testcase_03 AC 33 ms
53,040 KB
testcase_04 AC 35 ms
53,076 KB
testcase_05 AC 36 ms
52,800 KB
testcase_06 AC 35 ms
53,624 KB
testcase_07 AC 36 ms
52,696 KB
testcase_08 AC 52 ms
67,032 KB
testcase_09 AC 35 ms
53,816 KB
testcase_10 AC 34 ms
52,548 KB
testcase_11 AC 35 ms
53,180 KB
testcase_12 AC 35 ms
53,312 KB
testcase_13 AC 39 ms
52,004 KB
testcase_14 AC 34 ms
52,140 KB
testcase_15 AC 34 ms
53,420 KB
testcase_16 AC 35 ms
53,288 KB
testcase_17 AC 34 ms
53,020 KB
testcase_18 AC 34 ms
52,876 KB
testcase_19 AC 54 ms
66,972 KB
testcase_20 AC 41 ms
60,140 KB
testcase_21 AC 39 ms
59,332 KB
testcase_22 AC 42 ms
61,664 KB
testcase_23 AC 36 ms
52,864 KB
testcase_24 AC 35 ms
53,296 KB
testcase_25 AC 38 ms
58,432 KB
testcase_26 AC 34 ms
53,564 KB
testcase_27 AC 33 ms
53,192 KB
testcase_28 AC 35 ms
53,744 KB
testcase_29 AC 55 ms
70,468 KB
testcase_30 AC 36 ms
53,280 KB
testcase_31 AC 34 ms
52,824 KB
testcase_32 AC 37 ms
53,056 KB
testcase_33 AC 36 ms
52,616 KB
testcase_34 AC 35 ms
52,924 KB
testcase_35 AC 42 ms
60,380 KB
testcase_36 AC 68 ms
76,564 KB
testcase_37 AC 41 ms
60,292 KB
testcase_38 AC 36 ms
53,072 KB
testcase_39 AC 59 ms
70,744 KB
testcase_40 AC 53 ms
68,500 KB
testcase_41 AC 132 ms
98,572 KB
testcase_42 AC 56 ms
67,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect

N,M,K=map(int,input().split())
A=list(map(int,input().split()))+[0]

k=K//2
l=K-k

S={0}

for i in range(k):
    NS={0}
    for s in S:
        for a in A:
            if s+a<=M:
                NS.add(s+a)
    S=NS

X0=sorted(S)

S={0}

for i in range(l):
    NS={0}
    for s in S:
        for a in A:
            if s+a<=M:
                NS.add(s+a)
    S=NS

X1=sorted(S)
ANS=0

for x in X0:
    k=bisect(X1,M-x)
    if X1[k-1]+x<=M:
        ANS=max(ANS,X1[k-1]+x)

print(ANS)


0