結果

問題 No.180 美しいWhitespace (2)
ユーザー rlangevinrlangevin
提出日時 2024-03-06 12:16:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 69 ms / 5,000 ms
コード長 537 bytes
コンパイル時間 306 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 75,068 KB
最終ジャッジ日時 2024-03-06 12:16:37
合計ジャッジ時間 3,489 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,460 KB
testcase_01 AC 34 ms
53,460 KB
testcase_02 AC 35 ms
53,460 KB
testcase_03 AC 37 ms
59,316 KB
testcase_04 AC 48 ms
61,572 KB
testcase_05 AC 41 ms
61,564 KB
testcase_06 AC 48 ms
63,664 KB
testcase_07 AC 44 ms
63,656 KB
testcase_08 AC 56 ms
65,724 KB
testcase_09 AC 45 ms
59,296 KB
testcase_10 AC 43 ms
59,296 KB
testcase_11 AC 68 ms
75,068 KB
testcase_12 AC 64 ms
74,920 KB
testcase_13 AC 63 ms
74,920 KB
testcase_14 AC 65 ms
74,920 KB
testcase_15 AC 63 ms
74,920 KB
testcase_16 AC 62 ms
74,920 KB
testcase_17 AC 64 ms
74,920 KB
testcase_18 AC 66 ms
75,048 KB
testcase_19 AC 42 ms
59,296 KB
testcase_20 AC 36 ms
53,460 KB
testcase_21 AC 34 ms
53,460 KB
testcase_22 AC 36 ms
53,460 KB
testcase_23 AC 33 ms
53,460 KB
testcase_24 AC 34 ms
53,460 KB
testcase_25 AC 34 ms
53,460 KB
testcase_26 AC 34 ms
53,460 KB
testcase_27 AC 38 ms
53,460 KB
testcase_28 AC 36 ms
53,460 KB
testcase_29 AC 34 ms
53,460 KB
testcase_30 AC 54 ms
71,880 KB
testcase_31 AC 69 ms
74,920 KB
testcase_32 AC 41 ms
59,296 KB
testcase_33 AC 61 ms
74,920 KB
testcase_34 AC 63 ms
74,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N = int(input())
A, B = [0] * N, [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())
    
def f(x):
    ma = mi = A[0] + B[0] * x
    for i in range(1, N):
        ma = max(ma, A[i] + B[i] * x)
        mi = min(mi, A[i] + B[i] * x)
    return ma - mi

def df(x):
    return f(x+1) - f(x) >= 0

if df(1):
    print(1)
    exit()
    
no = 1
yes = 10 ** 18
while yes - no != 1:
    mid = (yes + no)//2
    if df(mid):
        yes = mid
    else:
        no = mid
        
print(yes)
0