結果

問題 No.1463 Hungry Kanten
ユーザー phocomphocom
提出日時 2021-04-02 21:33:58
言語 Ruby
(3.3.0)
結果
AC  
実行時間 811 ms / 2,000 ms
コード長 238 bytes
コンパイル時間 430 ms
コンパイル使用メモリ 11,316 KB
実行使用メモリ 47,032 KB
最終ジャッジ日時 2023-08-25 14:49:58
合計ジャッジ時間 5,778 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
15,356 KB
testcase_01 AC 67 ms
15,156 KB
testcase_02 AC 94 ms
16,144 KB
testcase_03 AC 684 ms
15,336 KB
testcase_04 AC 74 ms
15,356 KB
testcase_05 AC 811 ms
47,032 KB
testcase_06 AC 68 ms
15,204 KB
testcase_07 AC 68 ms
15,288 KB
testcase_08 AC 67 ms
15,312 KB
testcase_09 AC 70 ms
15,172 KB
testcase_10 AC 72 ms
15,216 KB
testcase_11 AC 72 ms
15,284 KB
testcase_12 AC 71 ms
15,384 KB
testcase_13 AC 74 ms
15,140 KB
testcase_14 AC 73 ms
15,452 KB
testcase_15 AC 75 ms
15,212 KB
testcase_16 AC 93 ms
16,316 KB
testcase_17 AC 128 ms
16,948 KB
testcase_18 AC 173 ms
16,256 KB
testcase_19 AC 365 ms
28,528 KB
testcase_20 AC 660 ms
32,080 KB
testcase_21 AC 69 ms
15,288 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:14: warning: mismatched indentations at 'end' with 'if' at 10
Syntax OK

ソースコード

diff #

N,K=gets.split.map &:to_i
A=gets.split.map &:to_i
require 'set'
ans = Set.new
(2**N).times{|b|
  s=0
  m=1
  c=0
  N.times{|i|
    if b[i]==1 then
		s+=A[i]
		m*=A[i]
		c+=1
	end
  }
  if c >= K then
	ans << s
	ans << m
  end
}
p ans.size
0