結果
| 問題 |
No.2071 Shift and OR
|
| コンテスト | |
| ユーザー |
urutom
|
| 提出日時 | 2022-10-13 17:32:07 |
| 言語 | Go (1.23.4) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 671 bytes |
| コンパイル時間 | 14,316 ms |
| コンパイル使用メモリ | 237,856 KB |
| 実行使用メモリ | 8,072 KB |
| 最終ジャッジ日時 | 2024-06-26 12:04:04 |
| 合計ジャッジ時間 | 18,741 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 WA * 8 |
ソースコード
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)
}
urutom