結果

問題 No.180 美しいWhitespace (2)
ユーザー e-mone-mon
提出日時 2015-10-27 19:32:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 522 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 10,728 KB
実行使用メモリ 8,392 KB
最終ジャッジ日時 2023-10-11 04:42:15
合計ジャッジ時間 3,013 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,708 KB
testcase_01 WA -
testcase_02 AC 18 ms
7,776 KB
testcase_03 AC 18 ms
7,776 KB
testcase_04 AC 22 ms
7,816 KB
testcase_05 AC 28 ms
7,812 KB
testcase_06 AC 32 ms
7,792 KB
testcase_07 AC 39 ms
7,756 KB
testcase_08 AC 43 ms
7,816 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 73 ms
8,212 KB
testcase_18 AC 72 ms
8,188 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 17 ms
7,904 KB
testcase_28 WA -
testcase_29 AC 16 ms
7,760 KB
testcase_30 AC 69 ms
8,188 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python
# -*- coding: utf-8 -*-

def f(x):
    max_f = -1
    min_f = 10**10
    for a,b in AB:
        max_f = max(max_f, a + b * x)
        min_f = min(min_f, a + b * x)
    return max_f - min_f


N = int(input())
AB = [list(map(int,input().split())) for i in range(0,N)]

left = 1
right = 10**9
while right - left > 2:
    y1 = f((left * 2 + right)//3)
    y2 = f((left+ right * 2)//3)

    if y1 <= y2:
        right = (left + right * 2)//3
    else:
        left = (left * 2 + right)//3

print(right-1)
0