結果
| 問題 |
No.698 ペアでチームを作ろう
|
| ユーザー |
hamachi470
|
| 提出日時 | 2021-09-02 00:21:24 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 116 ms / 1,000 ms |
| コード長 | 314 bytes |
| コンパイル時間 | 177 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 76,056 KB |
| 最終ジャッジ日時 | 2024-11-28 22:03:39 |
| 合計ジャッジ時間 | 2,401 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 |
ソースコード
N = int(input())
A = [int(x) for x in input().split()]
dp = [0]*(2**N)
for bit in range(2**N):
for x in range(N-1):
if bit>>x & 1:
continue
for y in range(x+1, N):
if bit>>y & 1:
continue
bn = bit+2**x+2**y
dp[bn] = max(dp[bn], dp[bit] + (A[x] ^ A[y]))
print(dp[2**N-1])
hamachi470