結果

問題 No.698 ペアでチームを作ろう
ユーザー GrayCoder
提出日時 2018-07-21 15:39:09
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 555 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 55 ms
コンパイル使用メモリ 14,976 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2026-10-08 03:33:27
合計ジャッジ時間 2,066 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 3 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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
    num = list(range(N))
    for n in combinations(num, N // 2):
        m = deque(set(num) - set(n))
        for _ in [0] * (N - 1):
            power = 0
            for i, j in zip(n, m):
                power += A[i] ^ A[j]
            ans = max(ans, power)
            m.rotate(1)
    print(ans)

main()
0