結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー d_nishiyama85d_nishiyama85
提出日時 2016-07-09 20:32:54
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 325 bytes
コンパイル時間 600 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 18,048 KB
最終ジャッジ日時 2024-04-21 10:56:24
合計ジャッジ時間 8,736 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
12,544 KB
testcase_01 AC 131 ms
12,544 KB
testcase_02 AC 183 ms
12,544 KB
testcase_03 AC 167 ms
12,288 KB
testcase_04 AC 117 ms
12,544 KB
testcase_05 AC 189 ms
12,288 KB
testcase_06 AC 138 ms
12,416 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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