結果

問題 No.3550 Another Rurumaru Function Problem
コンテスト
ユーザー 👑 loop0919
提出日時 2026-04-23 00:28:45
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 397 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 255 ms
コンパイル使用メモリ 85,248 KB
実行使用メモリ 103,552 KB
最終ジャッジ日時 2026-05-22 21:47:15
合計ジャッジ時間 5,430 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other AC * 13 WA * 28
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def f(x, y):
    res = 0
    for i in range(max(x.bit_length(), y.bit_length())):
        xi = (x >> i) & 1
        yi = (y >> i) & 1
        if i % 2 == 0:
            res |= (xi & yi) << i
        else:
            res |= (xi | yi) << i
    return res


N = int(input())
A = [int(s) for s in input().split()]
A.sort()

dp = A[0]

for i in range(1, N):
    dp = max(f(dp, A[i]), A[i])

print(dp)
0