結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
76,300 KB
testcase_01 AC 71 ms
71,832 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 71 ms
71,680 KB
testcase_05 AC 70 ms
71,672 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 73 ms
71,412 KB
testcase_09 AC 71 ms
71,512 KB
testcase_10 AC 70 ms
71,512 KB
testcase_11 AC 71 ms
71,680 KB
testcase_12 WA -
testcase_13 AC 72 ms
71,660 KB
testcase_14 AC 71 ms
71,468 KB
testcase_15 WA -
testcase_16 AC 97 ms
77,356 KB
testcase_17 AC 126 ms
77,912 KB
testcase_18 AC 133 ms
78,080 KB
testcase_19 AC 133 ms
78,260 KB
testcase_20 AC 129 ms
78,220 KB
testcase_21 AC 133 ms
78,460 KB
testcase_22 AC 138 ms
78,496 KB
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()
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