結果
| 問題 | No.698 ペアでチームを作ろう |
| ユーザー |
ikd
|
| 提出日時 | 2018-07-15 19:19:57 |
| 言語 | Nim (2.2.8) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 464 bytes |
| 記録 | |
| コンパイル時間 | 4,210 ms |
| コンパイル使用メモリ | 69,896 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-08-03 00:32:53 |
| 合計ジャッジ時間 | 5,931 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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