結果

問題 No.180 美しいWhitespace (2)
ユーザー maspy
提出日時 2020-03-06 17:48:12
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 500 ms / 5,000 ms
コード長 503 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 44,544 KB
最終ジャッジ日時 2024-10-14 02:56:49
合計ジャッジ時間 19,057 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np

# %%
N = int(readline())
AB = np.array(read().split(), np.int64)
A = AB[::2]
B = AB[1::2]

# %%


def f(x):
    C = A + B * x
    return C.max() - C.min()


# %%
left = 0
right = 10 ** 9 + 100
while left + 1 < right:
    mid = (left + right) // 2
    if f(mid + 1) >= f(mid):
        right = mid
    else:
        left = mid

print(right)
0