結果
問題 |
No.698 ペアでチームを作ろう
|
ユーザー |
|
提出日時 | 2018-07-21 20:09:21 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 523 bytes |
コンパイル時間 | 168 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 21,120 KB |
最終ジャッジ日時 | 2024-12-26 05:00:13 |
合計ジャッジ時間 | 21,840 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 2 TLE * 10 |
ソースコード
from itertools import combinations, permutations from sys import stdin, stdout input = lambda: stdin.readline().rstrip() write = stdout.write def main(): N = int(input()) A = tuple(map(int, input().split())) ans = 0 num = list(range(N)) for n1 in combinations(num, N // 2): m = set(num) - set(n1) for n2 in permutations(m, N // 2): power = 0 for i, j in zip(n1, n2): power += A[i] ^ A[j] ans = max(ans, power) print(ans) main()