結果

問題 No.947 ABC包囲網
ユーザー mkawa2mkawa2
提出日時 2021-03-18 22:03:42
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,264 bytes
コンパイル時間 309 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 83,712 KB
最終ジャッジ日時 2024-04-28 12:40:15
合計ジャッジ時間 9,045 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
58,112 KB
testcase_01 AC 42 ms
52,864 KB
testcase_02 AC 43 ms
52,608 KB
testcase_03 AC 43 ms
52,736 KB
testcase_04 AC 43 ms
52,608 KB
testcase_05 AC 43 ms
52,864 KB
testcase_06 AC 43 ms
52,480 KB
testcase_07 AC 43 ms
52,864 KB
testcase_08 AC 46 ms
52,480 KB
testcase_09 AC 42 ms
52,864 KB
testcase_10 AC 42 ms
52,608 KB
testcase_11 AC 43 ms
52,352 KB
testcase_12 AC 43 ms
52,864 KB
testcase_13 AC 43 ms
52,992 KB
testcase_14 AC 43 ms
53,120 KB
testcase_15 AC 151 ms
76,800 KB
testcase_16 AC 82 ms
75,904 KB
testcase_17 AC 120 ms
77,312 KB
testcase_18 AC 118 ms
76,672 KB
testcase_19 AC 111 ms
76,672 KB
testcase_20 AC 118 ms
76,544 KB
testcase_21 AC 115 ms
76,288 KB
testcase_22 AC 121 ms
76,672 KB
testcase_23 AC 125 ms
76,800 KB
testcase_24 AC 129 ms
76,928 KB
testcase_25 AC 116 ms
76,800 KB
testcase_26 AC 121 ms
76,544 KB
testcase_27 AC 118 ms
76,288 KB
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 sys

sys.setrecursionlimit(10**6)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.buffer.readline())
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def LI1(): return list(map(int1, sys.stdin.buffer.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def BI(): return sys.stdin.buffer.readline().rstrip()
def SI(): return sys.stdin.buffer.readline().rstrip().decode()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = 10**16
md = 998244353
# md = 10**9+7

from math import atan2
from bisect import *

n=II()
xy=LLI(n)

rxy=[(atan2(y,x),x,y) for x,y in xy]
rxy.sort(key=lambda x:x[0])
rr=[r for r,x,y in rxy]
# print(rxy)
# print(rr)

def rev(i):
    r,x,y=rxy[i]
    return atan2(-y,-x),-x,-y

ans=0
for j in range(n):
    for i in range(j):
        r1,x1,y1=rev(i)
        r2,x2,y2=rev(j)
        s=x1*y2-y1*x2
        if s==0:continue
        if s<0:r1,r2=r2,r1
        l=bisect_right(rr,r1)
        r=bisect_left(rr,r2)
        if l<=r:ans+=r-l
        else:ans+=n-l+r
        # print(i,j,l,r,ans)

print(ans//3)
0