結果
| 問題 |
No.947 ABC包囲網
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-12-10 22:06:22 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,120 bytes |
| コンパイル時間 | 165 ms |
| コンパイル使用メモリ | 82,520 KB |
| 実行使用メモリ | 84,552 KB |
| 最終ジャッジ日時 | 2024-06-24 02:25:55 |
| 合計ジャッジ時間 | 8,291 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 WA * 11 TLE * 2 -- * 30 |
ソースコード
#誤差ゲーで余りにも虚無なので多分そもそもの解法が間違っている.
import math
import bisect
tiny = 0.00000001
n = int(input())
a = []
for i in range(n):
x, y = map(float, input().split())
tmp = math.atan2(y, x)
if tmp < 0 : tmp = 2*math.pi+tmp
a.append(tmp / math.pi * 180)
a.sort()
ans = 0
for i in range(n):
for j in range(i+1, n):
if abs(a[i]-a[j])<tiny or abs(abs(a[i]-a[j])-180)<tiny : continue
diff = min(a[j]-a[i], 360-(a[j]-a[i]))
f = a[i]+180
g = a[j]+180
if f < 360 and g < 360 :
ans += bisect.bisect_left(a,g)-bisect.bisect_right(a,f)
elif f < 360 and g >= 360 :
g -= 360;
if abs(g+360-f-diff) < tiny:
ans += n - bisect.bisect_right(a,f)
ans += bisect.bisect_left(a,g)
else:
f,g = g,f
ans += bisect.bisect_left(a,g)-bisect.bisect_right(a,f)
elif f >= 360 and g >= 360:
f -= 360
g -= 360
ans += bisect.bisect_left(a,g)-bisect.bisect_right(a,f)
print(ans//3)