結果
| 問題 | No.3550 Another Rurumaru Function Problem |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-24 22:12:20 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,143 bytes |
| 記録 | |
| コンパイル時間 | 216 ms |
| コンパイル使用メモリ | 85,376 KB |
| 実行使用メモリ | 123,472 KB |
| 最終ジャッジ日時 | 2026-05-22 21:47:35 |
| 合計ジャッジ時間 | 14,351 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 33 WA * 8 |
ソースコード
import fractions
from itertools import product
from collections import defaultdict
from collections import deque
inf = 1 << 60
def sgn(x):
if x > 0:
return 1
elif x == 0:
return 0
else:
return -1
def popC(x):
ans = 0
while x != 0:
ans += x % 2
x //= 2
return ans
def LI():
return list(map(int, input().split()))
def II():
return int(input())
def SI():
return input()
def f(x, y):
ans = 0
for i in range(60):
bx = 0 if (x & (1 << i)) == 0 else 1
by = 0 if (y & (1 << i)) == 0 else 1
if i % 2:
ans += (1 << i)*(bx | by)
else:
ans += (1 << i)*(bx & by)
return ans
n = II()
a =LI()
b = [0 for _ in range(1<<15)]
mask = 0b0101010101010101010101010101010101010101
for x in a:
t = x&mask
s = bin(t)[2:].zfill(30)
s2 = []
for i in range(15):
s2.append(s[i*2+1])
s2 = int("".join(s2),base=2)
b[s2] |= x
mx = -1
for i in range((1<<15)-1,-1,-1):
if b[i] != 0:
if mx==-1:
mx = b[i]
else:
mx = max(mx,f(mx,b[i]))
print(mx)