結果

問題 No.451 575
ユーザー cielciel
提出日時 2016-12-03 23:26:42
言語 Ruby
(3.2.2)
結果
AC  
実行時間 256 ms / 2,000 ms
コード長 214 bytes
コンパイル時間 369 ms
コンパイル使用メモリ 11,500 KB
実行使用メモリ 21,244 KB
最終ジャッジ日時 2023-08-27 06:43:15
合計ジャッジ時間 7,731 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
15,036 KB
testcase_01 AC 80 ms
15,204 KB
testcase_02 AC 73 ms
15,272 KB
testcase_03 AC 75 ms
15,112 KB
testcase_04 AC 74 ms
15,148 KB
testcase_05 AC 78 ms
15,252 KB
testcase_06 AC 84 ms
15,716 KB
testcase_07 AC 171 ms
17,528 KB
testcase_08 AC 72 ms
15,140 KB
testcase_09 AC 76 ms
15,328 KB
testcase_10 AC 117 ms
17,988 KB
testcase_11 AC 207 ms
20,000 KB
testcase_12 AC 256 ms
21,244 KB
testcase_13 AC 242 ms
21,176 KB
testcase_14 AC 72 ms
15,200 KB
testcase_15 AC 73 ms
15,356 KB
testcase_16 AC 87 ms
16,140 KB
testcase_17 AC 130 ms
17,628 KB
testcase_18 AC 130 ms
17,676 KB
testcase_19 AC 113 ms
16,892 KB
testcase_20 AC 82 ms
16,208 KB
testcase_21 AC 79 ms
15,196 KB
testcase_22 AC 72 ms
15,284 KB
testcase_23 AC 235 ms
21,012 KB
testcase_24 AC 173 ms
19,020 KB
testcase_25 AC 74 ms
15,124 KB
testcase_26 AC 74 ms
15,204 KB
testcase_27 AC 75 ms
15,096 KB
testcase_28 AC 74 ms
15,428 KB
testcase_29 AC 81 ms
15,892 KB
testcase_30 AC 136 ms
17,692 KB
testcase_31 AC 78 ms
15,140 KB
testcase_32 AC 104 ms
15,644 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:11: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

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