結果

問題 No.1463 Hungry Kanten
ユーザー yuruhiyayuruhiya
提出日時 2021-04-02 21:56:06
言語 Crystal
(1.11.2)
結果
AC  
実行時間 906 ms / 2,000 ms
コード長 301 bytes
コンパイル時間 27,402 ms
コンパイル使用メモリ 263,284 KB
実行使用メモリ 134,756 KB
最終ジャッジ日時 2023-08-25 15:00:25
合計ジャッジ時間 25,417 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,936 KB
testcase_01 AC 3 ms
4,796 KB
testcase_02 AC 34 ms
11,640 KB
testcase_03 AC 789 ms
102,132 KB
testcase_04 AC 3 ms
5,112 KB
testcase_05 AC 906 ms
134,756 KB
testcase_06 AC 3 ms
4,796 KB
testcase_07 AC 3 ms
4,928 KB
testcase_08 AC 3 ms
5,064 KB
testcase_09 AC 3 ms
4,836 KB
testcase_10 AC 4 ms
5,164 KB
testcase_11 AC 4 ms
5,428 KB
testcase_12 AC 5 ms
5,652 KB
testcase_13 AC 4 ms
5,368 KB
testcase_14 AC 12 ms
7,652 KB
testcase_15 AC 5 ms
5,980 KB
testcase_16 AC 34 ms
11,492 KB
testcase_17 AC 95 ms
22,800 KB
testcase_18 AC 41 ms
15,432 KB
testcase_19 AC 454 ms
78,492 KB
testcase_20 AC 605 ms
118,900 KB
testcase_21 AC 4 ms
5,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

require "big"
n, k = read_line.split.map(&.to_i)
a = read_line.split.map(&.to_big_i)
puts [0, 1].repeated_permutations(n).select { |perm|
  perm.sum >= k
}.flat_map { |perm|
  b = (0...n).select { |i| perm[i] > 0 }.map { |i| a[i] }
  [b.sum, b.reduce(1.to_big_i) { |acc, val| acc * val }]
}.uniq.size
0