結果

問題 No.947 ABC包囲網
ユーザー face4face4
提出日時 2019-12-10 22:05:22
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,129 bytes
コンパイル時間 458 ms
コンパイル使用メモリ 87,308 KB
実行使用メモリ 83,800 KB
最終ジャッジ日時 2023-09-06 07:40:18
合計ジャッジ時間 9,862 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 TLE -
testcase_29 TLE -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#誤差ゲーで余りにも虚無なので多分そもそもの解法が間違っている.
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()
print(a)
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)
0