結果
| 問題 | No.1374 Absolute Game |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-02-05 22:45:53 |
| 言語 | Ruby (4.0.2) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 436 bytes |
| 記録 | |
| コンパイル時間 | 233 ms |
| コンパイル使用メモリ | 9,088 KB |
| 実行使用メモリ | 24,032 KB |
| 最終ジャッジ日時 | 2026-03-23 21:44:38 |
| 合計ジャッジ時間 | 3,748 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 4 WA * 20 RE * 2 |
コンパイルメッセージ
Syntax OK
ソースコード
def lscan; gets.split.map(&:to_i); end
gets
li = lscan.sort
n = li.size
n2 = n/2
n1 = n - n2
odd, even = li.each_slice(2).reduce([0, 0]){|s,e| s[0] += e[0]; e[1] and s[1] += e[1]; s }
score1 = li[0...n1].reduce(:+).abs - li[n1..-1].reduce(:+).abs
score2 = -li[0...n2].reduce(:+).abs + li[n2..-1].reduce(:+).abs
score3 = odd.abs - even.abs
best = [score1, score2, score3].max
best = [even.abs - odd.abs, best].max if n.even?
p best