結果

問題 No.180 美しいWhitespace (2)
ユーザー roiti46roiti46
提出日時 2015-04-06 00:29:31
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 584 bytes
コンパイル時間 748 ms
コンパイル使用メモリ 6,728 KB
実行使用メモリ 18,540 KB
最終ジャッジ日時 2023-09-17 04:57:41
合計ジャッジ時間 9,819 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
6,020 KB
testcase_01 WA -
testcase_02 AC 10 ms
6,100 KB
testcase_03 AC 10 ms
5,936 KB
testcase_04 AC 315 ms
6,576 KB
testcase_05 AC 2,119 ms
9,244 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

candx = set([])
for i in xrange(N):
    a1, b1 = ab[i]
    for j in xrange(i+1, N):
        a2, b2 = ab[j]
        if b2-b1 == 0:
            candx.add(0)
            continue
        x = abs((a1-a2)/(b1-b2))
        if x >  0: candx.add(x)
        if x >= 0: candx.add(x+1)
        if x >  1: candx.add(x-1)

ax, mn = 0, 10**50
for x in candx:
    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)
print ax
0