結果

問題 No.699 ペアでチームを作ろう2
ユーザー 👑 KazunKazun
提出日時 2021-02-25 03:26:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 120 ms / 1,000 ms
コード長 348 bytes
コンパイル時間 1,195 ms
コンパイル使用メモリ 81,432 KB
実行使用メモリ 83,660 KB
最終ジャッジ日時 2023-10-25 08:26:39
合計ジャッジ時間 3,190 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,436 KB
testcase_01 AC 38 ms
53,436 KB
testcase_02 AC 56 ms
66,224 KB
testcase_03 AC 39 ms
53,436 KB
testcase_04 AC 75 ms
75,760 KB
testcase_05 AC 119 ms
83,660 KB
testcase_06 AC 119 ms
83,660 KB
testcase_07 AC 118 ms
83,660 KB
testcase_08 AC 118 ms
83,660 KB
testcase_09 AC 118 ms
83,652 KB
testcase_10 AC 120 ms
83,656 KB
testcase_11 AC 120 ms
83,660 KB
testcase_12 AC 119 ms
83,652 KB
testcase_13 AC 118 ms
83,656 KB
testcase_14 AC 117 ms
83,660 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def dfs(S):
    if S==(1<<N)-1:
        return [0]

    x=0
    while S&(1<<x):
        x+=1

    F=[]
    T=S|(1<<x)
    for y in range(x+1,N):
        if T&(1<<y):
            continue
        B=dfs(T|(1<<y))

        for b in B:
            F.append((A[x]+A[y])^b)
    return F

N=int(input())
A=list(map(int,input().split()))
print(max(dfs(0)))
0