結果

問題 No.698 ペアでチームを作ろう
ユーザー ああいいああいい
提出日時 2022-01-28 01:13:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 504 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 87,032 KB
実行使用メモリ 77,380 KB
最終ジャッジ日時 2023-08-27 04:36:58
合計ジャッジ時間 2,750 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 69 ms
71,392 KB
testcase_02 WA -
testcase_03 AC 70 ms
71,428 KB
testcase_04 WA -
testcase_05 AC 122 ms
77,136 KB
testcase_06 AC 118 ms
77,092 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
権限があれば一括ダウンロードができます

ソースコード

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:
            index = j
            break
    b = S ^ maskj
    for u in range(N):
        masku = 1 << u
        if b & masku == 0:
            calc(b ^ masku,now + A[index] ^ A[u])
calc()
print(_max)
0