結果
問題 | No.698 ペアでチームを作ろう |
ユーザー | irumo8202 |
提出日時 | 2022-01-28 11:50:28 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 127 ms / 1,000 ms |
コード長 | 441 bytes |
コンパイル時間 | 464 ms |
コンパイル使用メモリ | 86,908 KB |
実行使用メモリ | 77,004 KB |
最終ジャッジ日時 | 2023-08-27 22:57:49 |
合計ジャッジ時間 | 2,830 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 71 ms
71,364 KB |
testcase_01 | AC | 71 ms
71,268 KB |
testcase_02 | AC | 85 ms
76,468 KB |
testcase_03 | AC | 70 ms
71,152 KB |
testcase_04 | AC | 87 ms
77,004 KB |
testcase_05 | AC | 124 ms
76,840 KB |
testcase_06 | AC | 125 ms
76,932 KB |
testcase_07 | AC | 127 ms
76,984 KB |
testcase_08 | AC | 126 ms
76,856 KB |
testcase_09 | AC | 126 ms
76,900 KB |
testcase_10 | AC | 126 ms
76,980 KB |
testcase_11 | AC | 126 ms
76,900 KB |
testcase_12 | AC | 126 ms
76,964 KB |
testcase_13 | AC | 125 ms
76,900 KB |
testcase_14 | AC | 126 ms
76,896 KB |
ソースコード
N = int(input()) A = list(map(int, input().split())) def dfs(tot, used): if used == (1 << N) - 1: return tot res = 0 for i in range(N): if used >> i & 1: continue for j in range(i + 1, N): if used >> j & 1: continue tmp = dfs(tot + (A[i] ^ A[j]), used | 1 << i | 1 << j) res = max(res, tmp) break return res print(dfs(0, 0))