結果
問題 | No.451 575 |
ユーザー | ikd |
提出日時 | 2017-03-31 18:34:04 |
言語 | Ruby (3.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 451 bytes |
コンパイル時間 | 49 ms |
コンパイル使用メモリ | 11,440 KB |
実行使用メモリ | 19,156 KB |
最終ジャッジ日時 | 2023-09-21 10:42:49 |
合計ジャッジ時間 | 9,221 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 75 ms
15,252 KB |
testcase_01 | AC | 76 ms
15,036 KB |
testcase_02 | RE | - |
testcase_03 | AC | 78 ms
15,108 KB |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | AC | 76 ms
15,024 KB |
testcase_09 | AC | 83 ms
15,208 KB |
testcase_10 | AC | 125 ms
16,484 KB |
testcase_11 | AC | 225 ms
18,540 KB |
testcase_12 | AC | 272 ms
19,156 KB |
testcase_13 | AC | 270 ms
19,140 KB |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | AC | 85 ms
15,892 KB |
testcase_21 | AC | 82 ms
15,368 KB |
testcase_22 | AC | 74 ms
15,100 KB |
testcase_23 | AC | 275 ms
19,120 KB |
testcase_24 | AC | 190 ms
18,000 KB |
testcase_25 | AC | 78 ms
15,308 KB |
testcase_26 | RE | - |
testcase_27 | RE | - |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | RE | - |
コンパイルメッセージ
Syntax OK
ソースコード
n=gets.to_i b=[] n.times do b<< gets.to_i end l, r=1, 10**18 b.each_with_index do |e, i| if i.even? if e<=l puts (-1) exit! end l, r=[1, e-r].max, e-l else if r<=e puts (-1) exit! end l, r=[1, l-e].max, r-e end end if l>r puts (-1) exit! end a=[(l+r)/2] (n-1).downto 0 do |i| if (i+1).even? a<< b[i]+a.last else a<< b[i]-a.last end end puts a.size a.reverse.map{|e| puts e}