結果

問題 No.180 美しいWhitespace (2)
ユーザー roiti46roiti46
提出日時 2015-04-06 00:49:29
言語 Python2
(2.7.18)
結果
AC  
実行時間 30 ms / 5,000 ms
コード長 474 bytes
コンパイル時間 406 ms
コンパイル使用メモリ 6,568 KB
実行使用メモリ 6,324 KB
最終ジャッジ日時 2023-09-17 05:40:31
合計ジャッジ時間 2,441 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,024 KB
testcase_01 AC 12 ms
5,900 KB
testcase_02 AC 11 ms
5,896 KB
testcase_03 AC 11 ms
5,900 KB
testcase_04 AC 13 ms
5,984 KB
testcase_05 AC 15 ms
5,960 KB
testcase_06 AC 16 ms
5,960 KB
testcase_07 AC 18 ms
5,896 KB
testcase_08 AC 20 ms
5,924 KB
testcase_09 AC 29 ms
6,316 KB
testcase_10 AC 29 ms
6,324 KB
testcase_11 AC 29 ms
6,176 KB
testcase_12 AC 29 ms
6,200 KB
testcase_13 AC 29 ms
6,116 KB
testcase_14 AC 29 ms
6,112 KB
testcase_15 AC 29 ms
6,220 KB
testcase_16 AC 29 ms
6,240 KB
testcase_17 AC 29 ms
6,116 KB
testcase_18 AC 29 ms
6,120 KB
testcase_19 AC 29 ms
6,120 KB
testcase_20 AC 11 ms
5,892 KB
testcase_21 AC 11 ms
6,036 KB
testcase_22 AC 11 ms
5,928 KB
testcase_23 AC 11 ms
5,976 KB
testcase_24 AC 11 ms
5,812 KB
testcase_25 AC 11 ms
5,976 KB
testcase_26 AC 11 ms
5,812 KB
testcase_27 AC 11 ms
5,820 KB
testcase_28 AC 11 ms
6,060 KB
testcase_29 AC 11 ms
5,824 KB
testcase_30 AC 29 ms
6,236 KB
testcase_31 AC 29 ms
6,192 KB
testcase_32 AC 29 ms
6,112 KB
testcase_33 AC 29 ms
6,304 KB
testcase_34 AC 30 ms
6,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(raw_input())
ab = [map(int, raw_input().split()) for i in xrange(N)]

l, r = 1, 10**10
x = (l+r)/2
ax, mn = 0, 10**50
for loop in xrange(40):
    abx = [a+b*x for a,b in ab]
    tmp = max(abx) - min(abx)
    if tmp < mn:
        mn = tmp
        ax = x
    if tmp == mn:
        ax = min(x, ax)
    abx1 = [a+b*(x+1) for a,b in ab]
    tmp1 = max(abx1) - min(abx1)
    if tmp1 < tmp:
        l = x
    else:
        r = x
    x = (l+r)/2 if r-l > 0 else x+1
print ax
0