結果

問題 No.699 ペアでチームを作ろう2
ユーザー rin204
提出日時 2022-03-23 16:02:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 120 ms / 1,000 ms
コード長 474 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 76,288 KB
最終ジャッジ日時 2024-10-11 18:58:41
合計ジャッジ時間 2,603 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))
used = [False] * n

def dfs(i, x):
    if 2 * i == n:
        return x
    
    for j in range(n):
        if not used[j]:
            used[j] = True
            a = A[j]
            break
    ret = 0
    for k in range(j + 1, n):
        if not used[k]:
            used[k] = True
            ret = max(ret, dfs(i + 1, x ^ (a + A[k])))
            used[k] = False
    used[j] = False
    return ret
    
print(dfs(0, 0))
0