結果

問題 No.699 ペアでチームを作ろう2
ユーザー cympfhcympfh
提出日時 2018-06-13 15:27:44
言語 Ruby
(3.3.0)
結果
AC  
実行時間 329 ms / 1,000 ms
コード長 293 bytes
コンパイル時間 64 ms
コンパイル使用メモリ 11,424 KB
実行使用メモリ 15,412 KB
最終ジャッジ日時 2023-09-13 03:53:11
合計ジャッジ時間 4,677 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
15,108 KB
testcase_01 AC 84 ms
15,108 KB
testcase_02 AC 79 ms
15,112 KB
testcase_03 AC 77 ms
15,248 KB
testcase_04 AC 97 ms
15,400 KB
testcase_05 AC 325 ms
15,240 KB
testcase_06 AC 328 ms
15,412 KB
testcase_07 AC 329 ms
15,212 KB
testcase_08 AC 327 ms
15,304 KB
testcase_09 AC 325 ms
15,164 KB
testcase_10 AC 327 ms
15,260 KB
testcase_11 AC 325 ms
15,384 KB
testcase_12 AC 324 ms
15,204 KB
testcase_13 AC 325 ms
15,180 KB
testcase_14 AC 326 ms
15,260 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def solve(xs, ac)
  return ac if xs.size == 0
  ys = xs.clone
  y = ys[0]
  ys.delete_at 0
  ans = 0
  ys.size.times do |i|
    zs = ys.clone
    z = ys[i]
    zs.delete_at i
    ans = [ans, solve(zs, (y + z) ^ ac)].max
  end
  ans
end
_ = gets.to_i
xs = gets.split.map(&:to_i)
p solve(xs, 0)
0