結果

問題 No.947 ABC包囲網
ユーザー titiatitia
提出日時 2019-12-10 01:56:30
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 872 bytes
コンパイル時間 1,002 ms
コンパイル使用メモリ 86,420 KB
実行使用メモリ 82,576 KB
最終ジャッジ日時 2023-09-05 17:14:07
合計ジャッジ時間 12,755 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
78,684 KB
testcase_01 AC 75 ms
71,164 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 77 ms
70,912 KB
testcase_05 AC 78 ms
70,992 KB
testcase_06 AC 78 ms
71,096 KB
testcase_07 AC 75 ms
71,200 KB
testcase_08 AC 73 ms
70,948 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 76 ms
71,552 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 101 ms
76,880 KB
testcase_17 AC 123 ms
77,536 KB
testcase_18 AC 152 ms
77,640 KB
testcase_19 AC 126 ms
77,516 KB
testcase_20 AC 126 ms
77,984 KB
testcase_21 AC 128 ms
77,912 KB
testcase_22 AC 135 ms
78,156 KB
testcase_23 AC 132 ms
77,580 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 1,891 ms
78,100 KB
testcase_29 TLE -
testcase_30 TLE -
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 #

n=int(input())
P=[tuple(map(int,input().split())) for i in range(n)]

Q=[]

import math

for x,y in P:
    if x==y==0:
        continue
    Q.append(math.atan2(y,x))

#print(Q)

Q.sort()

ANS=0
import bisect

for i in range(n-1):
    for j in range(i+1,n):
        if Q[j]-Q[i]>=math.pi:
            continue

        if Q[i]<=0 and Q[j]<=0:
            x=bisect.bisect_right(Q,Q[i]+math.pi)
            y=bisect.bisect_left(Q,Q[j]+math.pi)

            #print(i,j,x,y)
            ANS+=y-x

        elif Q[i]>=0 and Q[j]>=0:
            x=bisect.bisect_right(Q,Q[i]-math.pi)
            y=bisect.bisect_left(Q,Q[j]-math.pi)

            #print(i,j,x,y)
            ANS+=y-x

        else:
            x=bisect.bisect_right(Q,Q[i]+math.pi)
            y=bisect.bisect_left(Q,Q[j]-math.pi)

            #print(i,j,x,y)
            ANS+=(n-x)+y

print(ANS//2)

            
0