結果
| 問題 |
No.451 575
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-12-03 23:24:42 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 214 bytes |
| コンパイル時間 | 303 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 14,080 KB |
| 最終ジャッジ日時 | 2024-12-16 10:53:06 |
| 合計ジャッジ時間 | 6,593 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 2 |
| other | AC * 18 WA * 11 |
コンパイルメッセージ
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=[l-b[i],1].max,h-b[i]
else
l,h=[b[i]-h,1].max,b[i]-l
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