結果

問題 No.180 美しいWhitespace (2)
ユーザー tktk_snsntktk_snsn
提出日時 2021-03-20 17:14:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 127 ms / 5,000 ms
コード長 485 bytes
コンパイル時間 1,384 ms
コンパイル使用メモリ 86,708 KB
実行使用メモリ 77,056 KB
最終ジャッジ日時 2023-08-13 11:22:54
合計ジャッジ時間 7,150 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
70,924 KB
testcase_01 AC 91 ms
71,260 KB
testcase_02 AC 85 ms
71,264 KB
testcase_03 AC 109 ms
75,816 KB
testcase_04 AC 92 ms
75,780 KB
testcase_05 AC 96 ms
75,800 KB
testcase_06 AC 101 ms
76,308 KB
testcase_07 AC 98 ms
75,988 KB
testcase_08 AC 109 ms
76,328 KB
testcase_09 AC 125 ms
77,056 KB
testcase_10 AC 123 ms
76,752 KB
testcase_11 AC 116 ms
77,028 KB
testcase_12 AC 127 ms
76,916 KB
testcase_13 AC 121 ms
76,752 KB
testcase_14 AC 122 ms
77,052 KB
testcase_15 AC 117 ms
76,868 KB
testcase_16 AC 117 ms
76,876 KB
testcase_17 AC 119 ms
76,868 KB
testcase_18 AC 116 ms
76,796 KB
testcase_19 AC 119 ms
76,812 KB
testcase_20 AC 79 ms
71,172 KB
testcase_21 AC 78 ms
71,356 KB
testcase_22 AC 81 ms
71,296 KB
testcase_23 AC 80 ms
71,168 KB
testcase_24 AC 75 ms
71,268 KB
testcase_25 AC 77 ms
71,128 KB
testcase_26 AC 78 ms
71,288 KB
testcase_27 AC 81 ms
70,936 KB
testcase_28 AC 78 ms
71,432 KB
testcase_29 AC 79 ms
71,380 KB
testcase_30 AC 111 ms
76,924 KB
testcase_31 AC 115 ms
76,900 KB
testcase_32 AC 113 ms
76,836 KB
testcase_33 AC 114 ms
76,696 KB
testcase_34 AC 116 ms
76,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from operator import itemgetter
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
AB = tuple(tuple(map(int, input().split())) for _ in range(N))


def F(x):
    up = max(a+b*x for a, b in AB)
    dn = min(a+b*x for a, b in AB)
    return up - dn


l = 0
r = 10 ** 18
while r - l > 2:
    ml = (2 * l + r) // 3
    mr = (l + r * 2) // 3
    if ml >= mr:
        break
    if F(ml) <= F(mr):
        r = mr
    else:
        l = ml

print(l+1)
0