結果
| 問題 |
No.451 575
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-12-03 23:26:42 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 272 ms / 2,000 ms |
| コード長 | 214 bytes |
| コンパイル時間 | 338 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 17,536 KB |
| 最終ジャッジ日時 | 2024-12-26 17:56:03 |
| 合計ジャッジ時間 | 8,535 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 29 |
コンパイルメッセージ
Main.rb:11: warning: ambiguous first argument; put parentheses or a space even after `-' operator Syntax OK
ソースコード
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