結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー finefine
提出日時 2016-01-17 20:06:40
言語 Ruby
(3.3.0)
結果
AC  
実行時間 87 ms / 5,000 ms
コード長 354 bytes
コンパイル時間 223 ms
コンパイル使用メモリ 11,204 KB
実行使用メモリ 17,732 KB
最終ジャッジ日時 2023-09-11 23:05:32
合計ジャッジ時間 2,927 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,208 KB
testcase_01 AC 79 ms
15,328 KB
testcase_02 AC 82 ms
15,624 KB
testcase_03 AC 80 ms
15,344 KB
testcase_04 AC 77 ms
15,168 KB
testcase_05 AC 82 ms
16,152 KB
testcase_06 AC 78 ms
15,300 KB
testcase_07 AC 81 ms
15,368 KB
testcase_08 AC 80 ms
15,428 KB
testcase_09 AC 80 ms
15,316 KB
testcase_10 AC 81 ms
15,580 KB
testcase_11 AC 81 ms
15,364 KB
testcase_12 AC 87 ms
17,732 KB
testcase_13 AC 80 ms
15,144 KB
testcase_14 AC 85 ms
15,344 KB
testcase_15 AC 83 ms
15,588 KB
testcase_16 AC 78 ms
15,124 KB
testcase_17 AC 80 ms
15,080 KB
testcase_18 AC 83 ms
15,424 KB
testcase_19 AC 80 ms
15,064 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
a = gets.split.map(&:to_i).uniq.sort
a_size = a.size
if n < 101
ans = [0]
    1.upto(a_size){|i|
    ans = (ans + ans.map{|m|m ^ a[i-1]}).uniq
    if ans & a == a
        break
    end
    }
p ans.size
else
m = a.max.to_s(2).length
count = m
m.times{|i|
    if a.all?{|v|v[i] == 0}
        count -= 1
    end
    }
p 2 ** count
end    
    
0