結果

問題 No.909 たぴの配置
ユーザー TANIGUCHI KousukeTANIGUCHI Kousuke
提出日時 2019-12-06 17:56:10
言語 Ruby
(3.3.0)
結果
AC  
実行時間 394 ms / 3,000 ms
コード長 280 bytes
コンパイル時間 69 ms
コンパイル使用メモリ 11,568 KB
実行使用メモリ 44,900 KB
最終ジャッジ日時 2023-08-25 01:09:00
合計ジャッジ時間 6,975 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
15,172 KB
testcase_01 AC 75 ms
15,300 KB
testcase_02 AC 79 ms
15,084 KB
testcase_03 AC 75 ms
15,288 KB
testcase_04 AC 74 ms
15,332 KB
testcase_05 AC 376 ms
44,444 KB
testcase_06 AC 389 ms
44,712 KB
testcase_07 AC 361 ms
43,892 KB
testcase_08 AC 382 ms
44,348 KB
testcase_09 AC 394 ms
44,900 KB
testcase_10 AC 368 ms
44,012 KB
testcase_11 AC 366 ms
43,740 KB
testcase_12 AC 371 ms
44,124 KB
testcase_13 AC 389 ms
44,452 KB
testcase_14 AC 370 ms
44,024 KB
testcase_15 AC 364 ms
43,936 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def min(a,b); a < b ? a : b; end
  
N = gets.to_i
X = gets.split.map(&:to_i)
Y = gets.split.map(&:to_i)

L = N.times.inject(Float::INFINITY) do |d,i|
  min(d, X[i] + Y[i])
end
P = Array.new(N + 2, 0)
P[0] = 0
P[N + 1] = L
N.times do |i|
  P[i + 1] = min(L, X[i])
end
puts L
puts P
0