結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
12,160 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 88 ms
12,288 KB
testcase_05 WA -
testcase_06 AC 84 ms
12,160 KB
testcase_07 AC 82 ms
12,160 KB
testcase_08 AC 84 ms
12,288 KB
testcase_09 AC 86 ms
12,160 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) and ary[idx].nil?
                ary[idx] = true
            else
                ary[idx] = false
            end
        end
    else
        nums.each{ |num| ary[num] = false }
    end
end
puts (ary.index(true) || ary.index(nil))
0