結果

問題 No.451 575
ユーザー miraxialmiraxial
提出日時 2016-12-02 23:17:43
言語 Ruby
(3.3.0)
結果
AC  
実行時間 284 ms / 2,000 ms
コード長 171 bytes
コンパイル時間 351 ms
コンパイル使用メモリ 11,264 KB
実行使用メモリ 26,432 KB
最終ジャッジ日時 2023-08-27 02:41:45
合計ジャッジ時間 8,883 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,156 KB
testcase_01 AC 82 ms
15,068 KB
testcase_02 AC 82 ms
15,152 KB
testcase_03 AC 83 ms
15,028 KB
testcase_04 AC 83 ms
15,164 KB
testcase_05 AC 88 ms
15,408 KB
testcase_06 AC 97 ms
15,868 KB
testcase_07 AC 284 ms
26,432 KB
testcase_08 AC 82 ms
15,320 KB
testcase_09 AC 83 ms
15,268 KB
testcase_10 AC 119 ms
17,068 KB
testcase_11 AC 194 ms
19,888 KB
testcase_12 AC 225 ms
20,800 KB
testcase_13 AC 226 ms
20,972 KB
testcase_14 AC 84 ms
14,988 KB
testcase_15 AC 86 ms
15,588 KB
testcase_16 AC 97 ms
16,044 KB
testcase_17 AC 159 ms
19,328 KB
testcase_18 AC 158 ms
19,164 KB
testcase_19 AC 136 ms
17,960 KB
testcase_20 AC 92 ms
16,108 KB
testcase_21 AC 85 ms
15,376 KB
testcase_22 AC 85 ms
15,116 KB
testcase_23 AC 225 ms
21,020 KB
testcase_24 AC 166 ms
19,044 KB
testcase_25 AC 84 ms
14,988 KB
testcase_26 AC 83 ms
15,124 KB
testcase_27 AC 85 ms
15,240 KB
testcase_28 AC 84 ms
15,320 KB
testcase_29 AC 103 ms
16,040 KB
testcase_30 AC 166 ms
18,904 KB
testcase_31 AC 84 ms
15,272 KB
testcase_32 AC 152 ms
19,660 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n,*a=$<.map &:to_i
c=1
b=[]
2.times do
  b=[2-c]
  n.times do |i|
    b<< g=(i%2==0 ? 1:-1)*(a[i]-b[i])
    c=g if c>g
  end
end
puts b.all?{|i|i>0} ? ([n+1]+b).*("\n"):-1
0