結果

問題 No.699 ペアでチームを作ろう2
ユーザー 👑 rin204rin204
提出日時 2022-03-23 16:02:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 111 ms / 1,000 ms
コード長 474 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 82,096 KB
実行使用メモリ 76,088 KB
最終ジャッジ日時 2024-04-20 00:02:52
合計ジャッジ時間 2,391 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
51,840 KB
testcase_01 AC 36 ms
52,480 KB
testcase_02 AC 55 ms
64,768 KB
testcase_03 AC 37 ms
51,840 KB
testcase_04 AC 59 ms
75,676 KB
testcase_05 AC 109 ms
75,648 KB
testcase_06 AC 108 ms
76,088 KB
testcase_07 AC 110 ms
75,932 KB
testcase_08 AC 110 ms
75,648 KB
testcase_09 AC 109 ms
75,648 KB
testcase_10 AC 111 ms
75,776 KB
testcase_11 AC 111 ms
75,648 KB
testcase_12 AC 108 ms
75,552 KB
testcase_13 AC 111 ms
75,776 KB
testcase_14 AC 109 ms
75,648 KB
権限があれば一括ダウンロードができます

ソースコード

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