結果

問題 No.698 ペアでチームを作ろう
ユーザー GrayCoder
提出日時 2018-07-21 20:09:21
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
TLE  
実行時間 -
コード長 523 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 630 ms
コンパイル使用メモリ 20,824 KB
実行使用メモリ 23,420 KB
最終ジャッジ日時 2026-06-01 00:40:38
合計ジャッジ時間 4,600 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 2 TLE * 1 -- * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from itertools import combinations, permutations
from sys import stdin, stdout
input = lambda: stdin.readline().rstrip()
write = stdout.write

def main():
    N = int(input())
    A = tuple(map(int, input().split()))

    ans = 0
    num = list(range(N))
    for n1 in combinations(num, N // 2):
        m = set(num) - set(n1)
        for n2 in permutations(m, N // 2):
            power = 0
            for i, j in zip(n1, n2):
                power += A[i] ^ A[j]
            ans = max(ans, power)
    print(ans)

main()
0