結果

問題 No.947 ABC包囲網
ユーザー mkawa2mkawa2
提出日時 2019-12-16 18:30:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 1,067 bytes
コンパイル時間 396 ms
コンパイル使用メモリ 10,828 KB
実行使用メモリ 9,548 KB
最終ジャッジ日時 2023-09-15 18:20:10
合計ジャッジ時間 54,865 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,544 KB
testcase_01 AC 17 ms
8,644 KB
testcase_02 AC 16 ms
8,632 KB
testcase_03 AC 16 ms
8,752 KB
testcase_04 AC 17 ms
8,716 KB
testcase_05 AC 16 ms
8,504 KB
testcase_06 AC 17 ms
8,572 KB
testcase_07 AC 17 ms
8,712 KB
testcase_08 AC 17 ms
8,392 KB
testcase_09 AC 16 ms
8,452 KB
testcase_10 AC 16 ms
8,380 KB
testcase_11 AC 17 ms
8,544 KB
testcase_12 AC 17 ms
8,776 KB
testcase_13 AC 17 ms
8,732 KB
testcase_14 AC 16 ms
8,676 KB
testcase_15 AC 27 ms
8,680 KB
testcase_16 AC 25 ms
8,060 KB
testcase_17 AC 23 ms
8,684 KB
testcase_18 AC 24 ms
8,716 KB
testcase_19 AC 25 ms
8,020 KB
testcase_20 AC 24 ms
8,700 KB
testcase_21 AC 25 ms
8,720 KB
testcase_22 AC 25 ms
8,756 KB
testcase_23 AC 24 ms
8,608 KB
testcase_24 AC 24 ms
8,580 KB
testcase_25 AC 26 ms
8,712 KB
testcase_26 AC 24 ms
8,664 KB
testcase_27 AC 25 ms
8,668 KB
testcase_28 AC 23 ms
9,456 KB
testcase_29 TLE -
testcase_30 AC 23 ms
9,288 KB
testcase_31 TLE -
testcase_32 TLE -
testcase_33 TLE -
testcase_34 TLE -
testcase_35 TLE -
testcase_36 TLE -
testcase_37 TLE -
testcase_38 TLE -
testcase_39 TLE -
testcase_40 TLE -
testcase_41 TLE -
testcase_42 TLE -
testcase_43 TLE -
testcase_44 TLE -
testcase_45 TLE -
testcase_46 TLE -
testcase_47 TLE -
testcase_48 TLE -
testcase_49 TLE -
testcase_50 TLE -
testcase_51 AC 18 ms
8,736 KB
testcase_52 AC 18 ms
8,664 KB
testcase_53 AC 18 ms
8,648 KB
testcase_54 AC 16 ms
8,640 KB
testcase_55 AC 17 ms
8,768 KB
testcase_56 AC 17 ms
8,672 KB
testcase_57 AC 27 ms
8,688 KB
testcase_58 AC 27 ms
8,776 KB
testcase_59 AC 27 ms
8,712 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