結果

問題 No.2329 Nafmo、イカサマをする
ユーザー googol_S0googol_S0
提出日時 2023-05-28 13:45:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 397 ms / 2,000 ms
コード長 535 bytes
コンパイル時間 892 ms
コンパイル使用メモリ 87,244 KB
実行使用メモリ 116,772 KB
最終ジャッジ日時 2023-08-27 08:24:11
合計ジャッジ時間 7,397 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,048 KB
testcase_01 AC 85 ms
75,544 KB
testcase_02 AC 77 ms
71,220 KB
testcase_03 AC 78 ms
71,288 KB
testcase_04 AC 78 ms
70,960 KB
testcase_05 AC 76 ms
71,076 KB
testcase_06 AC 78 ms
71,076 KB
testcase_07 AC 78 ms
71,384 KB
testcase_08 AC 108 ms
77,364 KB
testcase_09 AC 80 ms
71,048 KB
testcase_10 AC 77 ms
71,276 KB
testcase_11 AC 78 ms
71,152 KB
testcase_12 AC 77 ms
71,388 KB
testcase_13 AC 80 ms
74,752 KB
testcase_14 AC 76 ms
71,332 KB
testcase_15 AC 78 ms
71,252 KB
testcase_16 AC 90 ms
75,888 KB
testcase_17 AC 77 ms
71,316 KB
testcase_18 AC 76 ms
71,308 KB
testcase_19 AC 96 ms
76,052 KB
testcase_20 AC 94 ms
76,232 KB
testcase_21 AC 88 ms
75,924 KB
testcase_22 AC 101 ms
76,608 KB
testcase_23 AC 79 ms
71,140 KB
testcase_24 AC 78 ms
71,220 KB
testcase_25 AC 88 ms
75,880 KB
testcase_26 AC 78 ms
71,192 KB
testcase_27 AC 78 ms
71,144 KB
testcase_28 AC 79 ms
71,364 KB
testcase_29 AC 123 ms
78,592 KB
testcase_30 AC 81 ms
75,196 KB
testcase_31 AC 76 ms
71,072 KB
testcase_32 AC 80 ms
75,524 KB
testcase_33 AC 76 ms
71,420 KB
testcase_34 AC 76 ms
71,368 KB
testcase_35 AC 96 ms
76,424 KB
testcase_36 AC 165 ms
80,992 KB
testcase_37 AC 90 ms
76,288 KB
testcase_38 AC 78 ms
71,248 KB
testcase_39 AC 152 ms
83,576 KB
testcase_40 AC 100 ms
76,292 KB
testcase_41 AC 397 ms
116,772 KB
testcase_42 AC 102 ms
76,412 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,K=map(int,input().split())
A=list(map(int,input().split()))
A.append(0)
N+=1
P=(K+1)>>1
Q=K>>1
X=[]
Y=[]
def p(x,i):
    if i==P:
        if x<=M:
            X.append(x)
    else:
        for j in range(N):
            p(x+A[j],i+1)

def q(x,i):
    if i==Q:
        if x<=M:
            Y.append(x)
    else:
        for j in range(N):
            q(x+A[j],i+1)

p(0,0)
q(0,0)
X.sort()
Y.sort()
Y.append(M+3)
from bisect import *
ANS=0
for i in range(len(X)):
    v=bisect_right(Y,M-X[i])
    ANS=max(ANS,Y[v-1]+X[i])
print(ANS)
0