結果

問題 No.180 美しいWhitespace (2)
ユーザー simansiman
提出日時 2023-05-09 17:54:20
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,864 ms / 5,000 ms
コード長 430 bytes
コンパイル時間 74 ms
コンパイル使用メモリ 11,416 KB
実行使用メモリ 55,692 KB
最終ジャッジ日時 2023-08-17 08:34:46
合計ジャッジ時間 36,368 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
15,488 KB
testcase_01 AC 96 ms
15,972 KB
testcase_02 AC 91 ms
15,536 KB
testcase_03 AC 105 ms
16,956 KB
testcase_04 AC 263 ms
19,472 KB
testcase_05 AC 437 ms
23,076 KB
testcase_06 AC 623 ms
27,944 KB
testcase_07 AC 809 ms
32,424 KB
testcase_08 AC 988 ms
36,604 KB
testcase_09 AC 1,858 ms
55,416 KB
testcase_10 AC 1,855 ms
55,308 KB
testcase_11 AC 1,856 ms
55,460 KB
testcase_12 AC 1,852 ms
55,456 KB
testcase_13 AC 1,846 ms
55,476 KB
testcase_14 AC 1,854 ms
55,300 KB
testcase_15 AC 1,848 ms
55,300 KB
testcase_16 AC 1,856 ms
55,232 KB
testcase_17 AC 1,848 ms
55,408 KB
testcase_18 AC 1,854 ms
55,428 KB
testcase_19 AC 1,848 ms
55,216 KB
testcase_20 AC 92 ms
15,368 KB
testcase_21 AC 91 ms
15,360 KB
testcase_22 AC 92 ms
15,524 KB
testcase_23 AC 89 ms
15,372 KB
testcase_24 AC 89 ms
15,392 KB
testcase_25 AC 93 ms
15,612 KB
testcase_26 AC 92 ms
15,400 KB
testcase_27 AC 93 ms
15,368 KB
testcase_28 AC 94 ms
15,420 KB
testcase_29 AC 97 ms
16,072 KB
testcase_30 AC 1,856 ms
55,524 KB
testcase_31 AC 1,864 ms
55,636 KB
testcase_32 AC 1,860 ms
55,692 KB
testcase_33 AC 1,857 ms
55,548 KB
testcase_34 AC 1,861 ms
55,532 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