結果

問題 No.699 ペアでチームを作ろう2
ユーザー rlangevinrlangevin
提出日時 2023-02-03 00:01:03
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 565 bytes
コンパイル時間 2,748 ms
コンパイル使用メモリ 86,908 KB
実行使用メモリ 81,816 KB
最終ジャッジ日時 2023-09-15 04:42:22
合計ジャッジ時間 20,626 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,744 KB
testcase_01 AC 74 ms
71,208 KB
testcase_02 AC 89 ms
76,660 KB
testcase_03 AC 72 ms
71,580 KB
testcase_04 AC 159 ms
77,244 KB
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import *

def popcount(n):
    cnt = 0
    while n:
        cnt += n & 1
        n //= 2
    return cnt

N = int(input())
A = list(map(int, input().split()))
ans = 0
N2 = 1 << N
for s in range(N2):
    if popcount(s) != N//2:
        continue
    one = []
    zero = []
    for i in range(N):
        if (s >> i) & 1:
            one.append(i)
        else:
            zero.append(i)
    
    for tup in permutations(one):
        val = 0
        for i in range(N//2):
            val ^= A[tup[i]] + A[zero[i]]
        ans = max(ans, val)
print(ans)
0