結果

問題 No.180 美しいWhitespace (2)
ユーザー TawaraTawara
提出日時 2015-08-26 19:22:25
言語 PyPy2
(7.3.15)
結果
TLE  
実行時間 -
コード長 560 bytes
コンパイル時間 1,238 ms
コンパイル使用メモリ 77,584 KB
実行使用メモリ 85,392 KB
最終ジャッジ日時 2023-09-25 18:35:12
合計ジャッジ時間 15,637 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
76,440 KB
testcase_01 AC 74 ms
76,468 KB
testcase_02 AC 75 ms
76,552 KB
testcase_03 AC 78 ms
77,528 KB
testcase_04 AC 110 ms
79,720 KB
testcase_05 AC 159 ms
79,676 KB
testcase_06 AC 443 ms
79,836 KB
testcase_07 AC 591 ms
79,784 KB
testcase_08 AC 1,072 ms
80,000 KB
testcase_09 AC 2,078 ms
80,168 KB
testcase_10 AC 2,022 ms
80,108 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 #

from math import floor, ceil
def func(x,tmpx,fx):
	l = [a + b*tmpx for a,b in ab]
	f_tmpx = max(l) - min(l)
	if f_tmpx < fx or (f_tmpx == fx and tmpx < x):
		return tmpx,f_tmpx
	else:
		return x,fx
N = int(raw_input())
ab = [map(int,raw_input().split(" ")) for i in xrange(N)]
x,f_x = 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,f_x = func(x,int(floor(tmpx)),f_x)
		x,f_x = func(x,int(ceil(tmpx)),f_x)
print x
0