結果
問題 | No.617 Nafmo、買い出しに行く |
ユーザー |
|
提出日時 | 2017-12-18 17:01:24 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 109 ms / 2,000 ms |
コード長 | 386 bytes |
コンパイル時間 | 640 ms |
コンパイル使用メモリ | 105,228 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-12 23:10:57 |
合計ジャッジ時間 | 2,474 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 |
ソースコード
import std.algorithm, std.conv, std.range, std.stdio, std.string;import std.bitmanip; // BitArrayvoid main(){auto rd = readln.split.to!(int[]), n = rd[0], k = rd[1];auto a = new int[](n);foreach (i; 0..n) a[i] = readln.chomp.to!int;auto ans = 0;foreach (i; 0..1<<n) {auto s = a.indexed(i.bitsSet).sum;if (s <= k) ans = max(ans, s);}writeln(ans);}