結果

問題 No.698 ペアでチームを作ろう
ユーザー むらためむらため
提出日時 2019-01-26 15:45:47
言語 Nim
(2.0.2)
結果
TLE  
実行時間 -
コード長 652 bytes
コンパイル時間 1,885 ms
コンパイル使用メモリ 67,856 KB
実行使用メモリ 7,192 KB
最終ジャッジ日時 2023-09-14 03:00:20
合計ジャッジ時間 5,924 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import sequtils
template `max=`*(x,y) = x = max(x,y)
template `min=`*(x,y) = x = min(x,y)

proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
proc scan(): int =
  while true:
    let k = getchar_unlocked()
    if k < '0': break
    result = 10 * result + k.ord - '0'.ord

# 14C2 * 12C2 * 10C2 * 8C2 * 6C2 * 4C2 * 2C2
# 高々:1*6*15*28*45*66*91 なので全て列挙
proc solve(A:seq[int]):int =
  if A.len == 2: return A[0] xor A[1]
  for x in 0..<A.len:
    for y in (x+1)..<A.len:
      result .max= solve(A[0..<x] & A[x+1..<y] & A[y+1..^1]) + (A[x] xor A[y])

let n = scan()
let A = newSeqWith(n,scan())
echo solve(A)
0