結果
問題 |
No.698 ペアでチームを作ろう
|
ユーザー |
|
提出日時 | 2021-09-27 00:55:16 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 391 bytes |
コンパイル時間 | 70 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,520 KB |
最終ジャッジ日時 | 2024-07-05 17:00:13 |
合計ジャッジ時間 | 7,282 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 3 WA * 9 |
ソースコード
from collections import * inf=10**16 n = int(input()) A = list(map(int,input().split())) dp=[-inf]*(1<<n) dp[0] = 0 for bit in range(1<<n): pre=dp[bit] for a in range(n): for b in range(a+1,n): if not (bit& (1<< a)) and not (bit& (1<< b)): nbit = bit + (1 << a) + (1 << b) dp[nbit]=max(dp[nbit],dp[bit]+A[a] ^ A[b]) print(dp[-1])