結果

問題 No.617 Nafmo、買い出しに行く
ユーザー nohakai3nohakai3
提出日時 2022-08-01 14:43:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 614 ms / 2,000 ms
コード長 283 bytes
コンパイル時間 300 ms
コンパイル使用メモリ 87,060 KB
実行使用メモリ 116,300 KB
最終ジャッジ日時 2023-09-29 09:20:28
合計ジャッジ時間 8,262 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
76,492 KB
testcase_01 AC 72 ms
71,424 KB
testcase_02 AC 83 ms
76,712 KB
testcase_03 AC 108 ms
80,652 KB
testcase_04 AC 74 ms
71,100 KB
testcase_05 AC 126 ms
86,164 KB
testcase_06 AC 515 ms
116,036 KB
testcase_07 AC 520 ms
115,820 KB
testcase_08 AC 73 ms
71,220 KB
testcase_09 AC 72 ms
71,368 KB
testcase_10 AC 600 ms
116,048 KB
testcase_11 AC 604 ms
116,300 KB
testcase_12 AC 604 ms
116,288 KB
testcase_13 AC 614 ms
116,048 KB
testcase_14 AC 613 ms
116,144 KB
testcase_15 AC 592 ms
116,124 KB
testcase_16 AC 595 ms
116,124 KB
testcase_17 AC 587 ms
116,116 KB
testcase_18 AC 75 ms
71,400 KB
testcase_19 AC 74 ms
71,600 KB
testcase_20 AC 74 ms
71,204 KB
testcase_21 AC 75 ms
71,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,input().split())
l=[]
for i in range(n):
    s=int(input())
    l.append(s)

l2=[]
for bit in range(1<<n):
    p=0
    for i in range(n):
        if bit&(1<<i):
            p+=l[i]
    l2.append(p)

l2.sort()
ans=0
for x in l2:
    if ans<=x<=k:
        ans=x

print(ans)
0