結果
| 問題 |
No.699 ペアでチームを作ろう2
|
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-20 21:05:20 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 85 ms / 1,000 ms |
| コード長 | 540 bytes |
| コンパイル時間 | 243 ms |
| コンパイル使用メモリ | 82,224 KB |
| 実行使用メモリ | 76,324 KB |
| 最終ジャッジ日時 | 2025-03-20 21:05:24 |
| 合計ジャッジ時間 | 1,864 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 |
ソースコード
N = int(input())
A = list(map(int, input().split()))
def dfs(mask, current_xor):
if mask == (1 << N) - 1:
return current_xor
# Find the first unused player
i = 0
while i < N and (mask & (1 << i)):
i += 1
max_val = 0
for j in range(i + 1, N):
if not (mask & (1 << j)):
new_mask = mask | (1 << i) | (1 << j)
s = A[i] + A[j]
res = dfs(new_mask, current_xor ^ s)
if res > max_val:
max_val = res
return max_val
print(dfs(0, 0))
lam6er