結果

問題 No.180 美しいWhitespace (2)
ユーザー convexineqconvexineq
提出日時 2020-12-13 14:19:02
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 67 ms / 5,000 ms
コード長 448 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 81,796 KB
実行使用メモリ 73,632 KB
最終ジャッジ日時 2023-10-20 03:41:35
合計ジャッジ時間 3,618 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,400 KB
testcase_01 AC 36 ms
53,400 KB
testcase_02 AC 35 ms
53,400 KB
testcase_03 AC 36 ms
53,400 KB
testcase_04 AC 45 ms
61,700 KB
testcase_05 AC 47 ms
63,748 KB
testcase_06 AC 50 ms
65,800 KB
testcase_07 AC 50 ms
65,796 KB
testcase_08 AC 53 ms
67,844 KB
testcase_09 AC 67 ms
73,324 KB
testcase_10 AC 64 ms
72,904 KB
testcase_11 AC 64 ms
73,424 KB
testcase_12 AC 64 ms
73,080 KB
testcase_13 AC 62 ms
73,268 KB
testcase_14 AC 64 ms
73,120 KB
testcase_15 AC 63 ms
73,080 KB
testcase_16 AC 63 ms
73,092 KB
testcase_17 AC 65 ms
73,140 KB
testcase_18 AC 64 ms
73,100 KB
testcase_19 AC 63 ms
73,352 KB
testcase_20 AC 37 ms
53,400 KB
testcase_21 AC 35 ms
53,400 KB
testcase_22 AC 36 ms
53,400 KB
testcase_23 AC 36 ms
53,400 KB
testcase_24 AC 35 ms
53,400 KB
testcase_25 AC 36 ms
53,400 KB
testcase_26 AC 36 ms
53,400 KB
testcase_27 AC 35 ms
53,400 KB
testcase_28 AC 35 ms
53,400 KB
testcase_29 AC 36 ms
53,400 KB
testcase_30 AC 65 ms
73,588 KB
testcase_31 AC 65 ms
73,632 KB
testcase_32 AC 62 ms
72,508 KB
testcase_33 AC 61 ms
72,508 KB
testcase_34 AC 63 ms
72,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def get(x):
    return max(a+b*x for a,b in ab) - min(a+b*x for a,b in ab)

n = int(input())
ab = [list(map(int,input().split())) for _ in range(n)]

l = 1
r = 2*10**9
cnt = 0
while r-l > 5:
    d = (r-l)//3
    m1 = l+d
    m2 = l+2*d
    if get(m1) <= get(m2):
        r = m2
    else:
        l = m1
    cnt += 1
    if cnt == 100: break

v = get(l)
c = l
for i in range(l,r):
    gi = get(i)
    if v > gi:
        v = gi
        c = i
print(c)
0