結果

問題 No.698 ペアでチームを作ろう
ユーザー AEnAEn
提出日時 2022-05-20 16:13:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 245 ms / 1,000 ms
コード長 291 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 81,836 KB
実行使用メモリ 77,176 KB
最終ジャッジ日時 2023-10-20 04:29:03
合計ジャッジ時間 3,774 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,524 KB
testcase_01 AC 41 ms
53,524 KB
testcase_02 AC 62 ms
70,676 KB
testcase_03 AC 37 ms
53,524 KB
testcase_04 AC 92 ms
76,100 KB
testcase_05 AC 244 ms
76,796 KB
testcase_06 AC 242 ms
77,084 KB
testcase_07 AC 241 ms
77,152 KB
testcase_08 AC 245 ms
77,152 KB
testcase_09 AC 243 ms
76,792 KB
testcase_10 AC 243 ms
77,144 KB
testcase_11 AC 245 ms
77,144 KB
testcase_12 AC 243 ms
77,116 KB
testcase_13 AC 239 ms
77,176 KB
testcase_14 AC 241 ms
77,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def p(sets, value):
    ans = []
    if not sets:
        return value
    m = min(sets)
    sets ^= {m}
    for nn in sets:
        ans.append(p(sets^{nn}, value+(A[m]^A[nn])))
    return max(ans)

sets = set(range(N))
print(p(sets, 0))
0