結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー hoktohokto
提出日時 2020-03-25 13:52:05
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 1,158 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 11,316 KB
実行使用メモリ 19,972 KB
最終ジャッジ日時 2023-08-30 09:34:51
合計ジャッジ時間 8,045 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
15,204 KB
testcase_01 AC 96 ms
15,328 KB
testcase_02 AC 116 ms
15,092 KB
testcase_03 AC 113 ms
15,356 KB
testcase_04 AC 97 ms
15,172 KB
testcase_05 AC 117 ms
15,424 KB
testcase_06 AC 98 ms
15,164 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 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

N=gets.to_i
A=get_i.sort!{|x,y| y<=>x}
dp=array(16384+1,false)
A.each do|a|
    dp[a]=true
end
A.each do|a|
    (16384+1).downto(0).each do|i|
        dp[i]=dp[i^a] if i^a<=16384 and dp[i^a]
    end
end
ans=0
dp.each do|f|
    ans+=1 if f
end
puts ans
0