結果
| 問題 |
No.698 ペアでチームを作ろう
|
| ユーザー |
ikd
|
| 提出日時 | 2018-07-15 19:19:57 |
| 言語 | Nim (2.2.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 464 bytes |
| コンパイル時間 | 3,220 ms |
| コンパイル使用メモリ | 65,828 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-01 03:11:22 |
| 合計ジャッジ時間 | 6,318 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 2 TLE * 1 -- * 9 |
ソースコード
import strutils, sequtils
var
n=stdin.readLine.parseInt
a=stdin.readLine.split.map(parseInt)
memo=newSeq[int](1 shl n)
proc f(bit: int): int=
if bit==(1 shl n)-1:
memo[bit]=0
else:
var ret=0
for i in 0..<n:
if (bit and (1 shl i))>0:
continue
for j in 0..<i:
if (bit and (1 shl j))>0:
continue
ret=max(ret, (a[i] xor a[j])+f(bit xor (1 shl i) xor (1 shl j)))
memo[bit]=ret
echo f(0)
ikd