結果

問題 No.24 数当てゲーム
ユーザー arucaraparucarap
提出日時 2021-08-23 13:33:54
言語 Ruby
(3.3.0)
結果
AC  
実行時間 92 ms / 5,000 ms
コード長 452 bytes
コンパイル時間 53 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-04-25 05:42:45
合計ジャッジ時間 1,549 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
12,288 KB
testcase_01 AC 84 ms
12,288 KB
testcase_02 AC 82 ms
12,160 KB
testcase_03 AC 92 ms
12,416 KB
testcase_04 AC 85 ms
12,160 KB
testcase_05 AC 82 ms
12,160 KB
testcase_06 AC 84 ms
12,160 KB
testcase_07 AC 82 ms
12,160 KB
testcase_08 AC 87 ms
12,288 KB
testcase_09 AC 83 ms
12,288 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

ary = Array.new(10)
N = gets.to_i
N.times do
    tmp = gets.split
    nums = tmp[0..-2].map(&:to_i)
    answer = tmp[-1]
    if answer == 'YES'
        ary.each_with_index do |status, idx|
            if nums.index(idx)
                ary[idx] = true if ary[idx].nil?
            else
                ary[idx] = false
            end
        end
    else
        nums.each{ |num| ary[num] = false }
    end
end
puts (ary.index(true) || ary.index(nil))
0