結果

問題 No.698 ペアでチームを作ろう
ユーザー Mr.FukuMr.Fuku
提出日時 2018-06-24 14:08:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 524 ms / 1,000 ms
コード長 593 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 10,968 KB
実行使用メモリ 7,928 KB
最終ジャッジ日時 2023-09-13 13:39:51
合計ジャッジ時間 6,455 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
7,832 KB
testcase_01 AC 16 ms
7,788 KB
testcase_02 AC 19 ms
7,792 KB
testcase_03 AC 16 ms
7,800 KB
testcase_04 AC 52 ms
7,872 KB
testcase_05 AC 488 ms
7,780 KB
testcase_06 AC 487 ms
7,832 KB
testcase_07 AC 521 ms
7,928 KB
testcase_08 AC 523 ms
7,760 KB
testcase_09 AC 522 ms
7,712 KB
testcase_10 AC 521 ms
7,808 KB
testcase_11 AC 522 ms
7,800 KB
testcase_12 AC 523 ms
7,784 KB
testcase_13 AC 520 ms
7,756 KB
testcase_14 AC 524 ms
7,788 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
lst = [int(a) for a in input().split()]

mx = 0
d = [0]*(n//2)
dd = [0]*n

def f(d,dd,index):
    global mx
    if index==n:
        ddd = [0]*(n//2)
        for a in range(n):
            ddd[dd[a]] ^= lst[a]
        mx = max(mx,sum(ddd))
        return
    
    for a in range(n//2):
        if d[a]==0:
            d[a]=1
            dd[index]=a
            f(d,dd,index+1)
            d[a]=0
            break
    
    for a in range(n//2):
        if d[a]==1:
            d[a]=2
            dd[index]=a
            f(d,dd,index+1)
            d[a]=1

f(d,dd,0)
print(mx)
0