結果

問題 No.180 美しいWhitespace (2)
ユーザー simansiman
提出日時 2023-05-09 17:54:20
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,881 ms / 5,000 ms
コード長 430 bytes
コンパイル時間 50 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 45,696 KB
最終ジャッジ日時 2024-05-04 15:25:48
合計ジャッジ時間 34,452 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
12,672 KB
testcase_01 AC 94 ms
12,928 KB
testcase_02 AC 90 ms
12,672 KB
testcase_03 AC 105 ms
13,824 KB
testcase_04 AC 261 ms
15,232 KB
testcase_05 AC 435 ms
17,920 KB
testcase_06 AC 605 ms
20,992 KB
testcase_07 AC 777 ms
26,496 KB
testcase_08 AC 951 ms
29,952 KB
testcase_09 AC 1,868 ms
45,568 KB
testcase_10 AC 1,800 ms
45,696 KB
testcase_11 AC 1,832 ms
45,440 KB
testcase_12 AC 1,784 ms
45,440 KB
testcase_13 AC 1,855 ms
45,568 KB
testcase_14 AC 1,790 ms
45,440 KB
testcase_15 AC 1,801 ms
45,696 KB
testcase_16 AC 1,800 ms
45,440 KB
testcase_17 AC 1,881 ms
45,568 KB
testcase_18 AC 1,784 ms
45,568 KB
testcase_19 AC 1,797 ms
45,696 KB
testcase_20 AC 91 ms
12,416 KB
testcase_21 AC 88 ms
12,544 KB
testcase_22 AC 88 ms
12,672 KB
testcase_23 AC 87 ms
12,416 KB
testcase_24 AC 85 ms
12,672 KB
testcase_25 AC 91 ms
12,672 KB
testcase_26 AC 91 ms
12,544 KB
testcase_27 AC 90 ms
12,416 KB
testcase_28 AC 90 ms
12,544 KB
testcase_29 AC 96 ms
12,672 KB
testcase_30 AC 1,786 ms
45,568 KB
testcase_31 AC 1,797 ms
45,568 KB
testcase_32 AC 1,818 ms
45,568 KB
testcase_33 AC 1,776 ms
45,524 KB
testcase_34 AC 1,792 ms
45,680 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
Q = N.times.map { gets.split.map(&:to_i) }

def ternary_search_tree(left, right)
  loop_cnt = 10000

  loop_cnt.times do
    if yield((left * 2 + right) / 3) <= yield((left + right * 2) / 3)
      right = (left + right * 2) / 3
    else
      left = (left * 2 + right) / 3
    end
  end

  (left + right) / 2
end

t = ternary_search_tree(1, 10 ** 10) { |x|
  u, v = Q.map { |a, b| a + b * x }.minmax
  v - u
}

pp t
0