結果
| 問題 | No.617 Nafmo、買い出しに行く | 
| コンテスト | |
| ユーザー |  maspy | 
| 提出日時 | 2020-01-20 17:11:27 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 490 ms / 2,000 ms | 
| コード長 | 303 bytes | 
| コンパイル時間 | 167 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 52,464 KB | 
| 最終ジャッジ日時 | 2024-07-02 22:41:35 | 
| 合計ジャッジ時間 | 11,601 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 20 | 
ソースコード
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N,K,*A = map(int,read().split())
wt = np.zeros(1<<N,np.int32)
for i,x in enumerate(A):
    wt[1<<i:1<<i+1] = wt[:1<<i] + x
answer = wt[wt <= K].max()
print(answer)
            
            
            
        