結果
問題 |
No.180 美しいWhitespace (2)
|
ユーザー |
|
提出日時 | 2015-04-06 00:29:31 |
言語 | Python2 (2.7.18) |
結果 |
WA
|
実行時間 | - |
コード長 | 584 bytes |
コンパイル時間 | 480 ms |
コンパイル使用メモリ | 7,040 KB |
実行使用メモリ | 13,888 KB |
最終ジャッジ日時 | 2024-07-04 02:25:02 |
合計ジャッジ時間 | 9,627 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 2 TLE * 1 -- * 28 |
ソースコード
N = int(raw_input()) ab = [map(int, raw_input().split()) for i in xrange(N)] candx = set([]) for i in xrange(N): a1, b1 = ab[i] for j in xrange(i+1, N): a2, b2 = ab[j] if b2-b1 == 0: candx.add(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