結果

問題 No.180 美しいWhitespace (2)
ユーザー TawaraTawara
提出日時 2015-08-26 18:11:56
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 515 bytes
コンパイル時間 474 ms
コンパイル使用メモリ 6,496 KB
実行使用メモリ 10,444 KB
最終ジャッジ日時 2023-09-25 18:34:42
合計ジャッジ時間 11,328 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,148 KB
testcase_01 AC 11 ms
6,008 KB
testcase_02 AC 11 ms
5,972 KB
testcase_03 AC 11 ms
6,104 KB
testcase_04 AC 134 ms
6,040 KB
testcase_05 WA -
testcase_06 AC 2,796 ms
6,116 KB
testcase_07 TLE -
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 #

from math import floor, ceil
def func(x,tmpx,fx):
	l = [a + b*tmpx for a,b in ab]
	flx = max(l) - min(l)
	if flx < fx:
		return tmpx,flx
	else:
		return x,fx
N = int(raw_input())
ab = [map(int,raw_input().split(" ")) for i in xrange(N)]
x,fx = func(1,1,10**10)
for i in xrange(N-1):
	for j in xrange(i+1,N):
		if ab[i][1] == ab[j][1]:
			continue
		tmpx = (ab[j][0] - ab[i][0])*(-1.) / (ab[j][1] - ab[i][1])
		if tmpx < 1:
			continue
		x,fx = func(x,int(floor(tmpx)),fx)
		x,fx = func(x,int(ceil(tmpx)),fx)
print x
0