結果

問題 No.699 ペアでチームを作ろう2
ユーザー nebukuro09
提出日時 2018-06-13 09:59:14
言語 PyPy2
(7.3.20)
コンパイル:
pypy2 -m py_compile _filename_
実行:
/usr/bin/pypy2 Main.pyc
結果
AC  
実行時間 868 ms / 1,000 ms
コード長 523 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 769 ms
コンパイル使用メモリ 80,960 KB
実行使用メモリ 83,676 KB
最終ジャッジ日時 2026-03-20 15:20:02
合計ジャッジ時間 10,358 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from itertools import combinations, permutations 

N = input()
A = sorted(map(int, raw_input().split()))
ans = 0
X = [0 for _ in xrange(N/2)]
Y = [0 for _ in xrange(N/2)]

for c in combinations(range(N), N/2):
    x, y = 0, 0
    for i in xrange(N):
        if i in c:
            X[x] = A[i]
            x += 1
        else:
            Y[y] = A[i]
            y += 1
    for p in permutations(X):
        tmp = 0
        for i in xrange(N/2):
            tmp ^= p[i] + Y[i]
        ans = max(ans, tmp)
        
print ans
0