結果

問題 No.699 ペアでチームを作ろう2
ユーザー maspy
提出日時 2020-02-05 15:28:32
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 327 ms / 1,000 ms
コード長 449 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 313 ms
コンパイル使用メモリ 20,576 KB
実行使用メモリ 15,360 KB
最終ジャッジ日時 2026-04-10 20:06:50
合計ジャッジ時間 4,958 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,*A = map(int, read().split())

def gen_powers(A):
    if not A:
        yield 0
        return
    for i, x in enumerate(A):
        if not i:
            continue
        pair_power = A[0] + x
        B = A[1:i] + A[i+1:]
        for p in gen_powers(B):
            yield p ^ pair_power

answer = max(gen_powers(A))
print(answer)
0