結果
問題 |
No.699 ペアでチームを作ろう2
|
ユーザー |
![]() |
提出日時 | 2023-02-03 00:01:03 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 565 bytes |
コンパイル時間 | 156 ms |
コンパイル使用メモリ | 82,352 KB |
実行使用メモリ | 77,108 KB |
最終ジャッジ日時 | 2024-07-02 09:47:34 |
合計ジャッジ時間 | 18,238 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 2 TLE * 10 |
ソースコード
from itertools import * def popcount(n): cnt = 0 while n: cnt += n & 1 n //= 2 return cnt N = int(input()) A = list(map(int, input().split())) ans = 0 N2 = 1 << N for s in range(N2): if popcount(s) != N//2: continue one = [] zero = [] for i in range(N): if (s >> i) & 1: one.append(i) else: zero.append(i) for tup in permutations(one): val = 0 for i in range(N//2): val ^= A[tup[i]] + A[zero[i]] ans = max(ans, val) print(ans)