結果

問題 No.180 美しいWhitespace (2)
ユーザー yaoshimaxyaoshimax
提出日時 2015-05-07 23:04:15
言語 PyPy2
(7.3.15)
結果
WA  
実行時間 -
コード長 881 bytes
コンパイル時間 1,467 ms
コンパイル使用メモリ 77,632 KB
実行使用メモリ 80,152 KB
最終ジャッジ日時 2023-09-19 08:10:25
合計ジャッジ時間 7,116 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
76,256 KB
testcase_01 AC 78 ms
76,264 KB
testcase_02 AC 79 ms
76,240 KB
testcase_03 AC 79 ms
76,456 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 135 ms
79,504 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 78 ms
76,584 KB
testcase_21 AC 78 ms
76,396 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 77 ms
76,324 KB
testcase_28 AC 78 ms
76,112 KB
testcase_29 AC 79 ms
76,116 KB
testcase_30 AC 125 ms
79,384 KB
testcase_31 AC 121 ms
79,196 KB
testcase_32 AC 110 ms
79,196 KB
testcase_33 WA -
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(raw_input())
ab=[map(int,raw_input().split()) for i in range(N)]
ab.sort()
minval=1000000001
ans=1000000001
for i in range(N):
    for j in range(i+1,N):
        ai,bi=ab[i][0],ab[i][1]
        aj,bj=ab[j][0],ab[j][1]
        ind=1
        if bi!=bj:
            ind=max(1,(aj-ai)/(bi-bj))
        #print aj,"+",ind,"*",bj,"-",ai,"+",ind,"*",bi
        if abs((aj+ind*bj)-(ai+ind*bi))<=minval:
            if abs((aj+ind*bj)-(ai+ind*bi))==minval:
                ans=min(ans,ind)
            else:
                ans=ind
            minval=abs((aj+ind*bj)-(ai+ind*bi))
        ind+=1
        #print aj,"+",ind,"*",bj,"-",ai,"+",ind,"*",bi
        if abs((aj+ind*bj)-(ai+ind*bi))<=minval:
            if abs((aj+ind*bj)-(ai+ind*bi))==minval:
                ans=min(ans,ind)
            else:
                ans=ind
            minval=abs((aj+ind*bj)-(ai+ind*bi))
print ans
0