結果

問題 No.999 てん vs. ほむ
ユーザー gemmarogemmaro
提出日時 2020-11-07 00:38:42
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 352 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 11,204 KB
実行使用メモリ 15,496 KB
最終ジャッジ日時 2023-09-29 19:52:14
合計ジャッジ時間 5,688 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
15,120 KB
testcase_01 AC 78 ms
15,096 KB
testcase_02 AC 76 ms
14,988 KB
testcase_03 AC 78 ms
15,036 KB
testcase_04 AC 77 ms
15,240 KB
testcase_05 AC 73 ms
14,988 KB
testcase_06 AC 76 ms
15,304 KB
testcase_07 AC 76 ms
15,092 KB
testcase_08 AC 1,051 ms
15,496 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

# frozen_string_literal: true

class Array
  def points
    (0..size).map do |n_left|
      s = 0

      each_with_index do |diff, index|
        index < n_left ? (s += diff) : (s -= diff)
      end

      s
    end
  end
end

def solve
  A.each_slice(2)
   .map { |l, r| l - r }
   .points.max
end

N = gets.to_i
A = gets.split.map(&:to_i)

puts solve
0