結果
| 問題 | No.698 ペアでチームを作ろう |
| ユーザー |
|
| 提出日時 | 2019-01-26 15:45:47 |
| 言語 | Nim (2.2.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 652 bytes |
| 記録 | |
| コンパイル時間 | 2,269 ms |
| コンパイル使用メモリ | 62,228 KB |
| 実行使用メモリ | 13,756 KB |
| 最終ジャッジ日時 | 2024-07-01 10:58:16 |
| 合計ジャッジ時間 | 6,611 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 1 TLE * 2 -- * 9 |
ソースコード
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)