結果
問題 |
No.180 美しいWhitespace (2)
|
ユーザー |
|
提出日時 | 2015-04-06 00:32:48 |
言語 | PyPy2 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 560 bytes |
コンパイル時間 | 1,389 ms |
コンパイル使用メモリ | 76,452 KB |
実行使用メモリ | 252,184 KB |
最終ジャッジ日時 | 2024-07-04 02:26:19 |
合計ジャッジ時間 | 11,749 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 7 TLE * 1 -- * 23 |
ソースコード
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