結果

問題 No.2071 Shift and OR
ユーザー urutomurutom
提出日時 2022-10-13 17:32:07
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 671 bytes
コンパイル時間 10,825 ms
コンパイル使用メモリ 209,696 KB
実行使用メモリ 8,196 KB
最終ジャッジ日時 2023-09-08 19:08:41
合計ジャッジ時間 18,822 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,380 KB
testcase_01 AC 4 ms
4,380 KB
testcase_02 AC 6 ms
4,376 KB
testcase_03 AC 11 ms
4,380 KB
testcase_04 AC 10 ms
4,376 KB
testcase_05 WA -
testcase_06 AC 10 ms
4,380 KB
testcase_07 AC 8 ms
4,380 KB
testcase_08 AC 9 ms
4,380 KB
testcase_09 AC 9 ms
4,376 KB
testcase_10 AC 10 ms
4,376 KB
testcase_11 AC 17 ms
4,376 KB
testcase_12 AC 17 ms
4,380 KB
testcase_13 WA -
testcase_14 AC 1 ms
4,376 KB
testcase_15 WA -
testcase_16 AC 14 ms
4,376 KB
testcase_17 WA -
testcase_18 AC 4 ms
4,376 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 1,174 ms
8,064 KB
testcase_24 AC 120 ms
4,380 KB
testcase_25 AC 548 ms
7,936 KB
testcase_26 AC 644 ms
7,924 KB
testcase_27 AC 8 ms
4,380 KB
testcase_28 AC 1,258 ms
8,008 KB
testcase_29 AC 1,265 ms
8,196 KB
testcase_30 AC 12 ms
4,376 KB
testcase_31 AC 10 ms
4,376 KB
testcase_32 AC 10 ms
4,376 KB
testcase_33 AC 10 ms
4,380 KB
testcase_34 AC 10 ms
4,376 KB
testcase_35 AC 11 ms
4,380 KB
testcase_36 AC 11 ms
4,376 KB
testcase_37 AC 10 ms
4,380 KB
testcase_38 AC 10 ms
4,380 KB
testcase_39 AC 10 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import "fmt"

func shift(a int) int {
	return (1<<15)*(a%2) + (a / 2)
}

func main() {
	var n int
	fmt.Scanln(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	if n >= 16 {
		fmt.Println((1 << 16) - 1)
		return
	}
	dp := make([]bool, 1<<16)
	x := a[0]
	for j := 0; j < 16; j++ {
		dp[x] = true
		x = shift(x)
	}
	for i := 1; i < n; i++ {
		x = a[i]
		temp := make([]bool, 1<<16)
		for j := 0; j < 16; j++ {
			for k := 0; k < (1 << 16); k++ {
				if dp[k] {
					temp[k^x] = true
				}
			}
			x = shift(x)
		}
		dp = temp
	}
	max := 0
	for k := 0; k < (1 << 16); k++ {
		if dp[k] && (k > max) {
			max = k
		}
	}
	fmt.Println(max)
}
0