結果

問題 No.699 ペアでチームを作ろう2
ユーザー lloyzlloyz
提出日時 2023-11-11 00:05:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 192 ms / 1,000 ms
コード長 598 bytes
コンパイル時間 319 ms
コンパイル使用メモリ 81,828 KB
実行使用メモリ 75,880 KB
最終ジャッジ日時 2023-11-11 00:05:08
合計ジャッジ時間 3,335 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 59 ms
68,688 KB
testcase_03 AC 36 ms
53,460 KB
testcase_04 AC 69 ms
75,740 KB
testcase_05 AC 182 ms
75,880 KB
testcase_06 AC 178 ms
75,880 KB
testcase_07 AC 191 ms
75,880 KB
testcase_08 AC 183 ms
75,880 KB
testcase_09 AC 184 ms
75,880 KB
testcase_10 AC 179 ms
75,880 KB
testcase_11 AC 181 ms
75,880 KB
testcase_12 AC 182 ms
75,752 KB
testcase_13 AC 181 ms
75,752 KB
testcase_14 AC 192 ms
75,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**6)

n = int(input())
A = list(map(int, input().split()))

def dfs(Used, curr):
    Used = list(Used)
    if min(Used) == 1:
        return curr
    ans = 0
    for i in range(n):
        if Used[i] == 0:
            for j in range(i + 1, n):
                if Used[j] == 0:
                    Used[i] = 1
                    Used[j] = 1
                    ans = max(ans, dfs(tuple(Used), curr ^ (A[i] + A[j])))
                    Used[i] = 0
                    Used[j] = 0
            break
    return ans

Used = [0 for _ in range(n)]
print(dfs(Used, 0))
0