結果

問題 No.698 ペアでチームを作ろう
ユーザー pluto77pluto77
提出日時 2018-08-17 13:43:25
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 146 ms / 1,000 ms
コード長 310 bytes
コンパイル時間 2,054 ms
コンパイル使用メモリ 76,288 KB
実行使用メモリ 78,976 KB
最終ジャッジ日時 2024-04-17 04:45:39
合計ジャッジ時間 3,636 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
75,648 KB
testcase_01 AC 92 ms
75,136 KB
testcase_02 AC 129 ms
78,208 KB
testcase_03 AC 94 ms
75,776 KB
testcase_04 AC 126 ms
78,720 KB
testcase_05 AC 139 ms
78,976 KB
testcase_06 AC 133 ms
78,464 KB
testcase_07 AC 138 ms
78,592 KB
testcase_08 AC 145 ms
78,464 KB
testcase_09 AC 146 ms
78,592 KB
testcase_10 AC 137 ms
78,848 KB
testcase_11 AC 137 ms
78,464 KB
testcase_12 AC 138 ms
78,336 KB
testcase_13 AC 138 ms
78,592 KB
testcase_14 AC 136 ms
78,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki698

dp=[0]*(1<<14)
n=int(raw_input())
a=map(int,raw_input().split())
for i in xrange(1<<n):
 if bin(i).count("1")%2:
  continue
 for j in xrange(n):
  if i&(1<<j):
   continue
  for k in xrange(n):
   if i&(1<<k):
    continue
   dp[i|1<<j|1<<k]=max(dp[i|1<<j|1<<k],dp[i]+(a[j]^a[k]))
print dp[(1<<n)-1]
0