結果

問題 No.698 ペアでチームを作ろう
ユーザー GrayCoderGrayCoder
提出日時 2018-07-21 20:09:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 523 bytes
コンパイル時間 435 ms
コンパイル使用メモリ 10,884 KB
実行使用メモリ 12,744 KB
最終ジャッジ日時 2023-08-27 00:45:02
合計ジャッジ時間 3,968 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,160 KB
testcase_01 AC 15 ms
8,068 KB
testcase_02 AC 43 ms
8,268 KB
testcase_03 AC 14 ms
8,160 KB
testcase_04 AC 679 ms
8,148 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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