結果

問題 No.180 美しいWhitespace (2)
ユーザー gigurururugigurururu
提出日時 2015-04-05 23:56:18
言語 Ruby
(3.3.0)
結果
AC  
実行時間 87 ms / 5,000 ms
コード長 234 bytes
コンパイル時間 61 ms
コンパイル使用メモリ 11,564 KB
実行使用メモリ 16,120 KB
最終ジャッジ日時 2023-09-17 04:47:49
合計ジャッジ時間 4,074 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,148 KB
testcase_01 AC 75 ms
15,164 KB
testcase_02 AC 80 ms
15,268 KB
testcase_03 AC 72 ms
15,160 KB
testcase_04 AC 71 ms
15,132 KB
testcase_05 AC 74 ms
15,148 KB
testcase_06 AC 73 ms
15,500 KB
testcase_07 AC 77 ms
15,420 KB
testcase_08 AC 78 ms
15,500 KB
testcase_09 AC 81 ms
15,892 KB
testcase_10 AC 82 ms
15,948 KB
testcase_11 AC 84 ms
15,812 KB
testcase_12 AC 86 ms
16,120 KB
testcase_13 AC 86 ms
15,820 KB
testcase_14 AC 81 ms
15,928 KB
testcase_15 AC 83 ms
15,920 KB
testcase_16 AC 84 ms
15,936 KB
testcase_17 AC 83 ms
16,000 KB
testcase_18 AC 85 ms
16,020 KB
testcase_19 AC 85 ms
15,924 KB
testcase_20 AC 75 ms
15,264 KB
testcase_21 AC 79 ms
15,268 KB
testcase_22 AC 72 ms
15,312 KB
testcase_23 AC 72 ms
15,144 KB
testcase_24 AC 74 ms
15,308 KB
testcase_25 AC 72 ms
15,088 KB
testcase_26 AC 74 ms
15,132 KB
testcase_27 AC 72 ms
15,132 KB
testcase_28 AC 73 ms
15,264 KB
testcase_29 AC 72 ms
15,024 KB
testcase_30 AC 81 ms
16,096 KB
testcase_31 AC 87 ms
15,832 KB
testcase_32 AC 85 ms
15,812 KB
testcase_33 AC 87 ms
16,000 KB
testcase_34 AC 83 ms
16,048 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N=gets.to_i
T=(1..N).map{gets.split.map(&:to_i)}
def f(w)
  n,x=T.map{|a,b|a+b*w}.minmax
  x-n
end
l=1
r=1000000000
while l+2<r
  if f((l*2+r)/3) <= f((l+r*2)/3)
    r=(l+r*2)/3
  else
    l=(l*2+r)/3
  end
end
p (l..r).min_by{|i|f i}
0