結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー d_nishiyama85
提出日時 2016-07-09 20:32:54
言語 Ruby
(3.4.1)
結果
TLE  
実行時間 -
コード長 325 bytes
コンパイル時間 587 ms
コンパイル使用メモリ 7,168 KB
実行使用メモリ 17,920 KB
最終ジャッジ日時 2024-10-13 09:41:20
合計ジャッジ時間 8,836 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5 TLE * 1 -- * 12
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

n = gets.to_i
as = gets.strip.split.map { |e|  e.to_i}

MAX = 32768

dp = Array.new(MAX, false)
nex = Array.new(MAX, false)

dp[0] = true

as.each{|i|
  MAX.times{|j|
    if dp[j]
      num = j ^ i
      nex[num] = true
    end
    nex[j] |= dp[j]
  }
  MAX.times{|j|
    dp[j] = nex[j]
  }
}

cnt = dp.count{|i| i}
puts cnt
0