結果

問題 No.451 575
ユーザー cielciel
提出日時 2016-12-03 23:30:42
言語 Ruby
(3.3.0)
結果
AC  
実行時間 324 ms / 2,000 ms
コード長 181 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 10,976 KB
実行使用メモリ 23,772 KB
最終ジャッジ日時 2023-08-27 06:43:41
合計ジャッジ時間 7,491 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,132 KB
testcase_01 AC 84 ms
15,056 KB
testcase_02 AC 83 ms
15,068 KB
testcase_03 AC 83 ms
15,192 KB
testcase_04 AC 84 ms
15,128 KB
testcase_05 AC 91 ms
15,512 KB
testcase_06 AC 102 ms
15,572 KB
testcase_07 AC 324 ms
23,772 KB
testcase_08 AC 83 ms
15,256 KB
testcase_09 AC 86 ms
15,420 KB
testcase_10 AC 131 ms
16,672 KB
testcase_11 AC 229 ms
18,956 KB
testcase_12 AC 273 ms
19,832 KB
testcase_13 AC 273 ms
19,836 KB
testcase_14 AC 85 ms
15,012 KB
testcase_15 AC 87 ms
15,644 KB
testcase_16 AC 99 ms
16,124 KB
testcase_17 AC 180 ms
18,492 KB
testcase_18 AC 183 ms
18,364 KB
testcase_19 AC 147 ms
17,600 KB
testcase_20 AC 91 ms
15,868 KB
testcase_21 AC 86 ms
15,216 KB
testcase_22 AC 84 ms
15,136 KB
testcase_23 AC 269 ms
19,836 KB
testcase_24 AC 195 ms
18,352 KB
testcase_25 AC 86 ms
15,236 KB
testcase_26 AC 85 ms
15,012 KB
testcase_27 AC 86 ms
15,128 KB
testcase_28 AC 85 ms
15,332 KB
testcase_29 AC 95 ms
15,852 KB
testcase_30 AC 182 ms
18,388 KB
testcase_31 AC 83 ms
15,056 KB
testcase_32 AC 156 ms
17,436 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n,*b=$<.map &:to_i
l,h=1,1<<60
n.times{|i|l,h=[[[b[i]-h,1].max,b[i]-l],[[l-b[i],1].max,h-b[i]]][i%2]}
a=[l]
(n-1).downto(0){|i|a<<b[i]+a[-1]*(i%2*2-1)}
puts l>h ?-1:[n+1,*a.reverse]
0