結果
| 問題 | No.698 ペアでチームを作ろう |
| ユーザー |
H20
|
| 提出日時 | 2021-05-27 10:29:19 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 491 bytes |
| 記録 | |
| コンパイル時間 | 63 ms |
| コンパイル使用メモリ | 82,764 KB |
| 実行使用メモリ | 83,376 KB |
| 最終ジャッジ日時 | 2026-09-19 13:45:04 |
| 合計ジャッジ時間 | 2,278 ms |
|
ジャッジサーバーID (参考情報) |
judge7_0 / judge5_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 3 WA * 9 |
ソースコード
def main():
N = int(input())
A = list(map(int,input().split()))
dp = [0]*(1<<N)
for s in range(0, 1<<N):#集合を添字の小さい順に試す
for i in range(N):#全ての要素のペアを考える
for j in range(i+1,N):
if (s>>i)&1==0 and (s>>j)&1==0:#i in not s and j in not s
if dp[s+(1<<i)+(1<<j)]<dp[s]+A[i]^A[j]:
dp[s+(1<<i)+(1<<j)]=dp[s]+A[i]^A[j]
return dp[-1]
print(main())
H20