結果
問題 | No.999 てん vs. ほむ |
ユーザー | gemmaro |
提出日時 | 2020-02-28 21:37:19 |
言語 | Ruby (3.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 345 bytes |
コンパイル時間 | 106 ms |
コンパイル使用メモリ | 7,296 KB |
実行使用メモリ | 28,160 KB |
最終ジャッジ日時 | 2024-04-21 18:06:16 |
合計ジャッジ時間 | 4,307 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 85 ms
12,288 KB |
testcase_01 | AC | 91 ms
12,032 KB |
testcase_02 | AC | 88 ms
12,160 KB |
testcase_03 | AC | 87 ms
12,032 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 84 ms
12,160 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | AC | 180 ms
25,088 KB |
testcase_18 | AC | 176 ms
24,704 KB |
testcase_19 | AC | 175 ms
24,832 KB |
testcase_20 | AC | 180 ms
25,088 KB |
testcase_21 | AC | 183 ms
27,520 KB |
testcase_22 | AC | 177 ms
27,008 KB |
コンパイルメッセージ
Syntax OK
ソースコード
# frozen_string_literal: true N = gets.to_i AS = gets.chomp.split.map(&:to_i) remain = AS diff = 0 loop do left = remain[0] - remain[1] right = remain[-1] - remain[-2] if left <= right remain.pop remain.pop diff += right else remain.shift remain.shift diff += left end break if remain.empty? end puts diff