結果
問題 |
No.698 ペアでチームを作ろう
|
ユーザー |
![]() |
提出日時 | 2021-03-30 03:35:13 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 57 ms / 1,000 ms |
コード長 | 392 bytes |
コンパイル時間 | 224 ms |
コンパイル使用メモリ | 82,200 KB |
実行使用メモリ | 65,280 KB |
最終ジャッジ日時 | 2024-11-29 23:40:48 |
合計ジャッジ時間 | 1,973 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
ソースコード
from collections import defaultdict n = int(input()) *a, = map(int,input().split()) d = {2**n-1:0} for _ in range(n//2): nd = defaultdict(int) for k,v in d.items(): idx = (k&-k).bit_length() - 1 k &= k-1 for i in range(idx+1,n): if k>>i&1: nk = k^(1<<i) nd[nk] = max(nd[nk], v + (a[idx]^a[i])) d = nd print(d[0])