結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,760 KB
testcase_01 AC 17 ms
7,856 KB
testcase_02 AC 16 ms
7,852 KB
testcase_03 AC 17 ms
7,760 KB
testcase_04 AC 27 ms
7,808 KB
testcase_05 AC 38 ms
7,920 KB
testcase_06 AC 49 ms
7,868 KB
testcase_07 AC 59 ms
7,776 KB
testcase_08 AC 69 ms
7,760 KB
testcase_09 AC 126 ms
8,288 KB
testcase_10 AC 124 ms
8,168 KB
testcase_11 AC 127 ms
8,296 KB
testcase_12 AC 127 ms
8,180 KB
testcase_13 AC 126 ms
8,288 KB
testcase_14 AC 127 ms
8,220 KB
testcase_15 AC 128 ms
8,284 KB
testcase_16 AC 127 ms
8,240 KB
testcase_17 AC 127 ms
8,352 KB
testcase_18 AC 128 ms
8,224 KB
testcase_19 AC 125 ms
8,220 KB
testcase_20 AC 16 ms
7,808 KB
testcase_21 WA -
testcase_22 AC 16 ms
7,928 KB
testcase_23 AC 16 ms
7,808 KB
testcase_24 AC 16 ms
7,760 KB
testcase_25 AC 16 ms
7,776 KB
testcase_26 AC 17 ms
7,916 KB
testcase_27 AC 16 ms
7,756 KB
testcase_28 AC 16 ms
7,804 KB
testcase_29 AC 16 ms
7,852 KB
testcase_30 AC 119 ms
8,348 KB
testcase_31 AC 126 ms
8,284 KB
testcase_32 AC 127 ms
8,264 KB
testcase_33 WA -
testcase_34 AC 131 ms
8,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def f(x):
    max_f = -1
    min_f = 10**20
    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
for i in range(100):
    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(int((left + right) * 0.5))
0