結果

問題 No.947 ABC包囲網
ユーザー mkawa2mkawa2
提出日時 2019-12-16 18:30:34
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 1,139 ms / 2,000 ms
コード長 1,067 bytes
コンパイル時間 416 ms
コンパイル使用メモリ 87,128 KB
実行使用メモリ 82,140 KB
最終ジャッジ日時 2023-09-15 18:25:11
合計ジャッジ時間 28,431 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,708 KB
testcase_01 AC 71 ms
71,612 KB
testcase_02 AC 72 ms
71,260 KB
testcase_03 AC 72 ms
71,636 KB
testcase_04 AC 72 ms
71,596 KB
testcase_05 AC 73 ms
71,668 KB
testcase_06 AC 72 ms
71,844 KB
testcase_07 AC 71 ms
71,980 KB
testcase_08 AC 72 ms
71,244 KB
testcase_09 AC 71 ms
71,540 KB
testcase_10 AC 70 ms
71,008 KB
testcase_11 AC 71 ms
71,780 KB
testcase_12 AC 70 ms
71,260 KB
testcase_13 AC 71 ms
71,708 KB
testcase_14 AC 73 ms
71,704 KB
testcase_15 AC 99 ms
77,084 KB
testcase_16 AC 87 ms
76,920 KB
testcase_17 AC 89 ms
76,600 KB
testcase_18 AC 92 ms
77,212 KB
testcase_19 AC 93 ms
77,008 KB
testcase_20 AC 92 ms
77,036 KB
testcase_21 AC 92 ms
77,160 KB
testcase_22 AC 91 ms
76,992 KB
testcase_23 AC 93 ms
77,052 KB
testcase_24 AC 93 ms
77,052 KB
testcase_25 AC 93 ms
77,012 KB
testcase_26 AC 92 ms
76,964 KB
testcase_27 AC 91 ms
77,028 KB
testcase_28 AC 87 ms
76,804 KB
testcase_29 AC 1,043 ms
81,388 KB
testcase_30 AC 89 ms
77,172 KB
testcase_31 AC 1,088 ms
81,864 KB
testcase_32 AC 1,072 ms
81,320 KB
testcase_33 AC 1,036 ms
81,492 KB
testcase_34 AC 1,060 ms
81,604 KB
testcase_35 AC 1,033 ms
81,340 KB
testcase_36 AC 1,093 ms
81,640 KB
testcase_37 AC 1,084 ms
81,616 KB
testcase_38 AC 1,061 ms
81,576 KB
testcase_39 AC 1,066 ms
81,932 KB
testcase_40 AC 1,062 ms
81,728 KB
testcase_41 AC 1,084 ms
81,224 KB
testcase_42 AC 1,085 ms
81,372 KB
testcase_43 AC 1,084 ms
81,580 KB
testcase_44 AC 1,110 ms
81,848 KB
testcase_45 AC 1,085 ms
82,120 KB
testcase_46 AC 1,103 ms
82,140 KB
testcase_47 AC 1,083 ms
81,452 KB
testcase_48 AC 1,099 ms
82,116 KB
testcase_49 AC 1,080 ms
81,880 KB
testcase_50 AC 1,139 ms
82,028 KB
testcase_51 AC 88 ms
76,508 KB
testcase_52 AC 84 ms
76,512 KB
testcase_53 AC 85 ms
76,620 KB
testcase_54 AC 74 ms
71,536 KB
testcase_55 AC 74 ms
71,804 KB
testcase_56 AC 73 ms
71,532 KB
testcase_57 AC 95 ms
77,288 KB
testcase_58 AC 94 ms
77,228 KB
testcase_59 AC 94 ms
77,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import *
from math import *
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    n = int(input())
    rad = []
    rxy = []
    for _ in range(n):
        x, y = MI()
        rxy.append((atan2(y, x), x, y))
    rxy.sort()
    rad = [r for r, x, y in rxy]
    # print(rxy)
    # print(rad)
    ans = 0
    for i, (r0, x0, y0) in enumerate(rxy[:-2]):
        if r0 >= 0: break
        r0p = atan2(-y0, -x0)
        L = bisect_right(rad, r0p)
        for r1, x1, y1 in rxy[i + 1:]:
            if r0 == r1: continue
            if r1 >= r0p: break
            r1p = atan2(-y1, -x1)
            R = bisect_left(rad, r1p)
            if r1p < 0: R = n
            ans += R - L
            # print(i, r0, x0, y0, atan2(-y0, -x0), L)
            # print(r1, x1, y1, atan2(-y1, -x1), R)
    print(ans)

main()
0