結果

問題 No.698 ペアでチームを作ろう
ユーザー ikdikd
提出日時 2018-07-15 19:17:13
言語 Nim
(2.0.2)
結果
TLE  
実行時間 -
コード長 416 bytes
コンパイル時間 2,943 ms
コンパイル使用メモリ 68,268 KB
実行使用メモリ 72,644 KB
最終ジャッジ日時 2023-09-13 18:33:13
合計ジャッジ時間 5,982 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,152 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 10 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 610 ms
4,380 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import strutils, sequtils

var
  n=stdin.readLine.parseInt
  a=stdin.readLine.split.map(parseInt)

proc f(bit: int): int=
  if bit==(1 shl n)-1:
    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)))
    ret

echo f(0)
0