結果

問題 No.617 Nafmo、買い出しに行く
ユーザー syunsukesyunsuke
提出日時 2019-06-03 23:20:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,272 ms / 2,000 ms
コード長 324 bytes
コンパイル時間 1,328 ms
コンパイル使用メモリ 81,648 KB
実行使用メモリ 75,256 KB
最終ジャッジ日時 2023-10-17 23:34:40
合計ジャッジ時間 15,274 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
59,964 KB
testcase_01 AC 37 ms
53,440 KB
testcase_02 AC 48 ms
62,152 KB
testcase_03 AC 108 ms
64,068 KB
testcase_04 AC 38 ms
53,440 KB
testcase_05 AC 166 ms
68,160 KB
testcase_06 AC 1,267 ms
75,240 KB
testcase_07 AC 1,269 ms
75,236 KB
testcase_08 AC 37 ms
53,440 KB
testcase_09 AC 37 ms
53,440 KB
testcase_10 AC 1,266 ms
75,236 KB
testcase_11 AC 1,271 ms
75,240 KB
testcase_12 AC 1,272 ms
75,256 KB
testcase_13 AC 1,272 ms
75,256 KB
testcase_14 AC 1,270 ms
75,252 KB
testcase_15 AC 1,268 ms
75,240 KB
testcase_16 AC 1,264 ms
75,240 KB
testcase_17 AC 1,264 ms
75,236 KB
testcase_18 AC 39 ms
53,440 KB
testcase_19 AC 38 ms
53,440 KB
testcase_20 AC 39 ms
53,440 KB
testcase_21 AC 38 ms
53,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,input().split())
A=[0 for i in range(N)]
for i in range(N):
    a=int(input())
    A[i]=a
    
ans=0
for i in range(2**N):
    I=i
    cnt=0
    for a in range(N):
        if I//(2**(N-1-a))==1:
            cnt+=A[a]
        I%=(2**(N-1-a))
    #print(i,cnt)
    if cnt<=K and ans<cnt:
        ans=cnt
print(ans)
0