結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー 小指が強い人小指が強い人
提出日時 2015-11-22 14:48:23
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 466 bytes
コンパイル時間 107 ms
コンパイル使用メモリ 11,268 KB
実行使用メモリ 19,500 KB
最終ジャッジ日時 2023-10-11 18:13:27
合計ジャッジ時間 7,300 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
19,500 KB
testcase_01 AC 82 ms
15,048 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
a = gets.split.map(&:to_i)
a.uniq!
h = Hash.new(0)
nh = Hash.new(0)
h[0] = 1
nh[0] = 1
n = a.length
n.times do |i|
    h[a[i]] = 1
    nh[a[i]] = 1
end
while true do
    nnh = Hash.new(0)
    nh.each_key do |x|
        h.each_key do |y|
            xor = x ^ y
            if !h.has_key?(xor)
                nnh[xor] = 1
            end
        end
    end
    if nnh.length == 0
        break
    end
    nh = nnh
    h.merge!(nnh)
end
puts h.length
0