結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー yukirinyukirin
提出日時 2016-02-24 00:52:32
言語 Go
(1.22.1)
結果
RE  
実行時間 -
コード長 625 bytes
コンパイル時間 10,728 ms
コンパイル使用メモリ 227,168 KB
実行使用メモリ 6,248 KB
最終ジャッジ日時 2024-04-19 05:41:31
合計ジャッジ時間 12,034 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 RE -
testcase_08 AC 89 ms
6,144 KB
testcase_09 AC 61 ms
6,144 KB
testcase_10 AC 74 ms
6,248 KB
testcase_11 AC 91 ms
6,144 KB
testcase_12 RE -
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 99 ms
6,144 KB
testcase_15 AC 95 ms
6,144 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 25 ms
6,144 KB
testcase_18 RE -
testcase_19 AC 16 ms
5,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	ss := make([]int, n)
	for i := range ss {
		ss[i] = nextInt()
	}

	dp := make([]bool, 1<<14+1)
	dp[0] = true

	for _, v := range ss {
		next := make([]bool, 1<<14+1)
		for k, v2 := range dp {
			if v2 {
				next[k] = true
				next[k^v] = true
			}
		}
		dp = next
	}
	sum := 0
	for _, v := range dp {
		if v {
			sum++
		}
	}
	fmt.Println(sum)
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextLine())
	return i
}
0