結果

問題 No.698 ペアでチームを作ろう
ユーザー nmnmnmnmnmnmnmnmnmnmnmnmnmnm
提出日時 2018-04-29 16:56:39
言語 Python2
(2.7.18)
結果
AC  
実行時間 628 ms / 1,000 ms
コード長 437 bytes
コンパイル時間 116 ms
コンパイル使用メモリ 6,468 KB
実行使用メモリ 6,236 KB
最終ジャッジ日時 2023-09-10 08:03:59
合計ジャッジ時間 7,317 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
5,964 KB
testcase_01 AC 11 ms
5,968 KB
testcase_02 AC 15 ms
6,084 KB
testcase_03 AC 11 ms
6,140 KB
testcase_04 AC 56 ms
6,188 KB
testcase_05 AC 617 ms
6,072 KB
testcase_06 AC 614 ms
6,012 KB
testcase_07 AC 619 ms
6,004 KB
testcase_08 AC 621 ms
6,200 KB
testcase_09 AC 623 ms
6,176 KB
testcase_10 AC 626 ms
6,056 KB
testcase_11 AC 624 ms
6,048 KB
testcase_12 AC 628 ms
6,236 KB
testcase_13 AC 619 ms
6,048 KB
testcase_14 AC 614 ms
6,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = input()
b = map(int,raw_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 i in xrange(n):
			ddd[dd[i]] ^= b[i]
		mx = max(mx,sum(ddd))
		return
	for i in xrange(n/2):
		if d[i] == 0:
			d[i] = 1
			dd[index]=i
			f(d,dd,index+1)
			d[i]=0
			break
	for i in xrange(n/2):
		if d[i] == 1:
			d[i] = 2
			dd[index]=i
			f(d,dd,index+1)
			d[i]=1

f(d,dd,0)
print mx
0