結果

問題 No.24 数当てゲーム
ユーザー naotest2naotest2
提出日時 2017-05-26 17:59:45
言語 Ruby
(3.3.0)
結果
AC  
実行時間 90 ms / 5,000 ms
コード長 557 bytes
コンパイル時間 54 ms
コンパイル使用メモリ 11,940 KB
実行使用メモリ 16,312 KB
最終ジャッジ日時 2023-10-20 00:14:41
合計ジャッジ時間 1,683 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
16,312 KB
testcase_01 AC 86 ms
16,308 KB
testcase_02 AC 83 ms
16,308 KB
testcase_03 AC 83 ms
16,308 KB
testcase_04 AC 85 ms
16,308 KB
testcase_05 AC 90 ms
16,308 KB
testcase_06 AC 87 ms
16,308 KB
testcase_07 AC 86 ms
16,308 KB
testcase_08 AC 86 ms
16,308 KB
testcase_09 AC 85 ms
16,308 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:7: warning: assigned but unused variable - num
Syntax OK

ソースコード

diff #

require 'set'
N=gets.chomp.to_i

setno = Set.new
setyes = Set.new
is_first = true
for num in 1..N
  ts = gets.chomp.split
  if ts[4] == 'NO'
    for i in 0..3
      setno.add(ts[i].to_i)
    end
  else
    if is_first
      setyes = Set.new
      for i in 0..3
        setyes.add(ts[i].to_i)
      end
      is_first = false
    else
      t = Set.new
      for i in 0..3
        t.add(ts[i].to_i)
      end
      setyes = setyes & t
    end
  end
end

if setno.size == 9
  puts (Set[0,1,2,3,4,5,6,7,8,9] - setno).to_a
else
  puts (setyes - setno).to_a
end
0