結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー 👑 horiesinitihoriesiniti
提出日時 2018-03-13 20:19:17
言語 Ruby
(3.2.2)
結果
AC  
実行時間 96 ms / 5,000 ms
コード長 304 bytes
コンパイル時間 394 ms
コンパイル使用メモリ 11,376 KB
実行使用メモリ 17,516 KB
最終ジャッジ日時 2023-09-12 16:55:07
合計ジャッジ時間 3,824 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,216 KB
testcase_01 AC 79 ms
15,316 KB
testcase_02 AC 82 ms
15,696 KB
testcase_03 AC 80 ms
15,328 KB
testcase_04 AC 81 ms
15,256 KB
testcase_05 AC 85 ms
16,612 KB
testcase_06 AC 81 ms
15,224 KB
testcase_07 AC 96 ms
17,492 KB
testcase_08 AC 90 ms
16,608 KB
testcase_09 AC 89 ms
16,412 KB
testcase_10 AC 91 ms
16,472 KB
testcase_11 AC 90 ms
16,668 KB
testcase_12 AC 90 ms
17,336 KB
testcase_13 AC 80 ms
15,028 KB
testcase_14 AC 82 ms
15,268 KB
testcase_15 AC 90 ms
16,880 KB
testcase_16 AC 80 ms
15,256 KB
testcase_17 AC 89 ms
16,432 KB
testcase_18 AC 96 ms
17,516 KB
testcase_19 AC 88 ms
16,468 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:18: warning: assigned but unused variable - e2
Syntax OK

ソースコード

diff #

hs={}
gets
x=gets.split.map{|e| e.to_i}
x.each{|e|
	hs[e]=1
}
hs2={}
hs2[0]=0
cs=16.times.map{0}
hs.keys.sort.each{|e|
	p1=32768
	p2=15
	while (p1&e)==0
		p1/=2
		p2-=1
	end
	
	e2=(p1-1)&e
	hs3={}
	if hs2.key?(e)==false
		hs2.each{|k,v|
			hs3[k^e]=0
		}
		cs[p2]+=1
	end
	hs2.update(hs3)
}
puts hs2.size
0