結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー ともきともき
提出日時 2015-06-16 00:42:56
言語 Scala(Beta)
(3.4.0)
結果
AC  
実行時間 1,366 ms / 5,000 ms
コード長 528 bytes
コンパイル時間 12,977 ms
コンパイル使用メモリ 259,304 KB
実行使用メモリ 62,788 KB
最終ジャッジ日時 2023-08-22 06:42:52
合計ジャッジ時間 38,144 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 952 ms
62,396 KB
testcase_01 AC 962 ms
62,480 KB
testcase_02 AC 983 ms
62,700 KB
testcase_03 AC 975 ms
62,588 KB
testcase_04 AC 966 ms
62,544 KB
testcase_05 AC 976 ms
62,732 KB
testcase_06 AC 978 ms
62,496 KB
testcase_07 AC 1,335 ms
62,584 KB
testcase_08 AC 1,335 ms
62,436 KB
testcase_09 AC 1,240 ms
62,788 KB
testcase_10 AC 1,285 ms
62,464 KB
testcase_11 AC 1,363 ms
62,704 KB
testcase_12 AC 977 ms
62,396 KB
testcase_13 AC 966 ms
62,404 KB
testcase_14 AC 974 ms
62,640 KB
testcase_15 AC 1,366 ms
62,732 KB
testcase_16 AC 977 ms
62,200 KB
testcase_17 AC 1,093 ms
62,520 KB
testcase_18 AC 1,323 ms
62,612 KB
testcase_19 AC 1,037 ms
62,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import scala.io.StdIn.readLine

object Main{
  def ipow(x : Integer,n : Integer) : Integer=
    if(x == n)
      1
    else if(n % 2 == 0)
      ipow(x*x,n/2)
    else
      x * ipow(x*x,n/2)

  def main(args: Array[String]) = {
    val n = readLine().toInt
    val a = readLine().split(" ").map(_.toInt).sorted.distinct
    val dp = Array.fill(ipow(2,15))(false)
    dp(0) = true
    for(ia <- a){
      for(i <- 0 until dp.length){
        dp(i ^ ia) = dp(i ^ ia) || dp(i)
      }
    }
    println(dp.count(_ == true))
  }
}
0