結果

問題 No.698 ペアでチームを作ろう
ユーザー GrayCoderGrayCoder
提出日時 2018-07-21 15:39:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 555 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 10,932 KB
実行使用メモリ 8,684 KB
最終ジャッジ日時 2023-08-27 00:37:19
合計ジャッジ時間 1,845 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,640 KB
testcase_01 AC 18 ms
8,624 KB
testcase_02 AC 22 ms
8,504 KB
testcase_03 AC 18 ms
8,568 KB
testcase_04 WA -
testcase_05 AC 69 ms
8,448 KB
testcase_06 AC 68 ms
8,572 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
権限があれば一括ダウンロードができます

ソースコード

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
    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