結果

問題 No.3550 Another Rurumaru Function Problem
コンテスト
ユーザー K2
提出日時 2026-05-22 22:53:08
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 607 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 321 ms
コンパイル使用メモリ 85,504 KB
実行使用メモリ 114,176 KB
最終ジャッジ日時 2026-05-22 22:53:16
合計ジャッジ時間 6,587 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 41
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

# 偶数番目は全部1じゃなきゃいけなくて、奇数番目はどれかが1じゃなきゃいけない

from functools import reduce
from operator import or_

N = int(input())
A = list(map(int, input().split()))

res1 = 0
res2 = 0

for i in range(29, -1, -1):
    # print(f"{i:2}", " ".join(map(lambda a: f"{a:030b}", A)))
    if i & 1:
        res1 |= max(a & 1 << i for a in A)
    else:
        na = list(filter(lambda a: (a >> i & 1) == 1, A))
        if na and reduce(or_, na) & res1 == res1:
            res2 |= 1 << i
            A = na

res = res1 | res2
# print(res)
print(f"{res:030b}")
0