結果

問題 No.698 ペアでチームを作ろう
ユーザー GrayCoder
提出日時 2018-07-21 15:26:47
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 520 bytes
コンパイル時間 79 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-12-26 04:51:25
合計ジャッジ時間 1,887 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 2 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
from itertools import combinations
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
    for a in combinations(A, N // 2):
        b = deque(set(A) - set(a))
        for _ in [0] * (N - 1):
            power = 0
            for x, y in zip(a, b):
                power += x ^ y
            ans = max(ans, power)
            b.rotate(1)
    print(ans)

main()
0