結果

問題 No.699 ペアでチームを作ろう2
ユーザー titiatitia
提出日時 2023-10-17 03:00:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 595 ms / 1,000 ms
コード長 500 bytes
コンパイル時間 104 ms
コンパイル使用メモリ 11,800 KB
実行使用メモリ 10,144 KB
最終ジャッジ日時 2023-10-17 03:01:05
合計ジャッジ時間 7,047 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,140 KB
testcase_01 AC 27 ms
10,140 KB
testcase_02 AC 33 ms
10,144 KB
testcase_03 AC 28 ms
10,140 KB
testcase_04 AC 68 ms
10,144 KB
testcase_05 AC 572 ms
10,144 KB
testcase_06 AC 571 ms
10,144 KB
testcase_07 AC 580 ms
10,144 KB
testcase_08 AC 592 ms
10,144 KB
testcase_09 AC 566 ms
10,144 KB
testcase_10 AC 591 ms
10,144 KB
testcase_11 AC 565 ms
10,144 KB
testcase_12 AC 595 ms
10,144 KB
testcase_13 AC 567 ms
10,144 KB
testcase_14 AC 593 ms
10,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def dfs(USE,NOW):
    USE=list(USE)

    if min(USE)==1:
        return NOW

    ANS=0

    for i in range(len(USE)):
        if USE[i]==0:
            for j in range(i+1,len(USE)):
                if USE[j]==0:

                    USE[i]=1
                    USE[j]=1

                    ANS=max(ANS,dfs(tuple(USE),NOW^(A[i]+A[j])))

                    USE[i]=0
                    USE[j]=0

            break

    return ANS

print(dfs([0]*N,0))
0