結果
問題 | No.698 ペアでチームを作ろう |
ユーザー | GrayCoder |
提出日時 | 2018-07-22 20:32:42 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 946 bytes |
コンパイル時間 | 131 ms |
コンパイル使用メモリ | 11,092 KB |
実行使用メモリ | 115,500 KB |
最終ジャッジ日時 | 2023-08-27 00:59:39 |
合計ジャッジ時間 | 14,302 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 15 ms
7,788 KB |
testcase_01 | AC | 15 ms
8,192 KB |
testcase_02 | AC | 20 ms
8,756 KB |
testcase_03 | AC | 16 ms
7,776 KB |
testcase_04 | AC | 79 ms
15,340 KB |
testcase_05 | TLE | - |
testcase_06 | TLE | - |
testcase_07 | TLE | - |
testcase_08 | TLE | - |
testcase_09 | TLE | - |
testcase_10 | TLE | - |
testcase_11 | TLE | - |
testcase_12 | TLE | - |
testcase_13 | TLE | - |
testcase_14 | TLE | - |
ソースコード
from sys import stdin, stdout input = lambda: stdin.readline().rstrip() write = stdout.write def main(): global A, Ret n = int(input()) A = tuple(map(int, input().split())) Ret = [] fp(n) ans = 0 for x in Ret: pwr = 0 for i, j in x: pwr += A[i] ^ A[j] ans = max(ans, pwr) print(ans) def fp(n, d=0, dd=0, idx=0): nh = n // 2 if not d: d = [0] * nh if not dd: dd = [0] * n if idx == n: pair = [[] for _ in [0] * nh] for i in range(n): pair[dd[i]].append(i) Ret.append(pair) return for i in range(nh): if d[i] == 0: d[i] = 1 dd[idx] = i fp(n, d, dd, idx + 1) d[i] = 0 break for i in range(nh): if d[i] == 1: d[i] = 2 dd[idx] = i fp(n, d, dd, idx + 1) d[i] = 1 main()