結果
| 問題 |
No.699 ペアでチームを作ろう2
|
| ユーザー |
neko_the_shadow
|
| 提出日時 | 2019-03-15 18:40:22 |
| 言語 | Ruby (3.4.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 390 bytes |
| コンパイル時間 | 48 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 17,920 KB |
| 最終ジャッジ日時 | 2024-07-01 20:04:39 |
| 合計ジャッジ時間 | 4,353 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 TLE * 1 |
| other | AC * 1 TLE * 1 -- * 10 |
コンパイルメッセージ
Syntax OK
ソースコード
n = gets.to_i
a = gets.split.map(&:to_i)
stack = [[[], 0]]
ans = 0
until stack.empty?
e, bit = stack.pop
if e.size == n / 2
ans = [ans, e.reduce{|x, y| x ^ y}].max
else
(0...n).each do |x|
((x + 1)...n).each do |y|
stack << [[*e, a[x] + a[y]], (bit | (1 << x) | (1 << y))] if (bit & (1 << x)) == 0 && (bit & (1 << y)) == 0
end
end
end
end
puts ans
neko_the_shadow