結果

問題 No.180 美しいWhitespace (2)
ユーザー roiti46roiti46
提出日時 2015-04-06 00:32:48
言語 PyPy2
(7.3.15)
結果
TLE  
実行時間 -
コード長 560 bytes
コンパイル時間 1,050 ms
コンパイル使用メモリ 77,512 KB
実行使用メモリ 250,168 KB
最終ジャッジ日時 2023-09-17 04:58:57
合計ジャッジ時間 11,122 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
80,600 KB
testcase_01 AC 65 ms
76,456 KB
testcase_02 AC 63 ms
76,196 KB
testcase_03 AC 65 ms
76,396 KB
testcase_04 AC 99 ms
80,384 KB
testcase_05 AC 186 ms
86,484 KB
testcase_06 AC 570 ms
97,044 KB
testcase_07 AC 806 ms
113,756 KB
testcase_08 AC 1,199 ms
122,756 KB
testcase_09 AC 143 ms
79,964 KB
testcase_10 AC 141 ms
79,892 KB
testcase_11 TLE -
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([1])
for i in xrange(N):
    a1, b1 = ab[i]
    for j in xrange(i+1, N):
        a2, b2 = ab[j]
        if b2-b1 == 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