結果

問題 No.698 ペアでチームを作ろう
ユーザー ああいいああいい
提出日時 2022-01-28 01:09:58
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 460 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 87,016 KB
実行使用メモリ 665,500 KB
最終ジャッジ日時 2023-08-27 04:31:45
合計ジャッジ時間 4,832 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

import sys
sys.setrecursionlimit(10 ** 8)
_max = 0
def calc(S = 0,now = 0):
    global _max
    if S == (1 << N) - 1:
        if now > _max:
            _max = now
        return
    for j in range(N):
        maskj = 1 << j
        if maskj & S == 0:break
    b = S ^ maskj
    for u in range(N):
        masku = 1 << u
        if b & masku:
            calc(b - masku,now + A[j] ^ A[u])
calc()
print(_max)
0