結果
問題 | No.451 575 |
ユーザー |
![]() |
提出日時 | 2016-12-02 22:54:51 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 594 ms / 2,000 ms |
コード長 | 323 bytes |
コンパイル時間 | 426 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 25,456 KB |
最終ジャッジ日時 | 2024-12-16 11:11:19 |
合計ジャッジ時間 | 7,626 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 29 |
コンパイルメッセージ
Main.rb:22: warning: ambiguous first argument; put parentheses or a space even after `-' operator Syntax OK
ソースコード
n=gets.to_i a=[] n.times do |i| a<< gets.to_i end c=1 e=0 while true do b=[] b<< 2-c (n/2).times do |i| b<< a[i*2]-b[i*2] b<< b[i*2+1]-a[i*2+1] end (n%2).times do b<< a[-1]-b[-1] end if b.all?{|i|i>0} puts n+1,b.*("\n") break elsif e==10 p -1 break end c=1 (n+1).times do |i| c=b[i] if c>b[i] end e+=1 end