結果
問題 | No.947 ABC包囲網 |
ユーザー | mkawa2 |
提出日時 | 2021-03-18 22:34:05 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 735 ms / 2,000 ms |
コード長 | 1,304 bytes |
コンパイル時間 | 379 ms |
コンパイル使用メモリ | 82,128 KB |
実行使用メモリ | 79,104 KB |
最終ジャッジ日時 | 2024-04-28 13:01:55 |
合計ジャッジ時間 | 18,404 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 42 ms
53,248 KB |
testcase_01 | AC | 42 ms
52,480 KB |
testcase_02 | AC | 42 ms
52,736 KB |
testcase_03 | AC | 42 ms
53,248 KB |
testcase_04 | AC | 42 ms
53,248 KB |
testcase_05 | AC | 42 ms
52,864 KB |
testcase_06 | AC | 42 ms
53,248 KB |
testcase_07 | AC | 42 ms
52,480 KB |
testcase_08 | AC | 41 ms
52,992 KB |
testcase_09 | AC | 43 ms
53,120 KB |
testcase_10 | AC | 43 ms
52,480 KB |
testcase_11 | AC | 42 ms
52,608 KB |
testcase_12 | AC | 40 ms
52,480 KB |
testcase_13 | AC | 43 ms
52,736 KB |
testcase_14 | AC | 42 ms
53,120 KB |
testcase_15 | AC | 81 ms
74,384 KB |
testcase_16 | AC | 65 ms
75,440 KB |
testcase_17 | AC | 70 ms
70,528 KB |
testcase_18 | AC | 61 ms
67,968 KB |
testcase_19 | AC | 62 ms
69,504 KB |
testcase_20 | AC | 62 ms
70,016 KB |
testcase_21 | AC | 61 ms
69,964 KB |
testcase_22 | AC | 60 ms
68,480 KB |
testcase_23 | AC | 61 ms
69,120 KB |
testcase_24 | AC | 61 ms
69,248 KB |
testcase_25 | AC | 62 ms
69,888 KB |
testcase_26 | AC | 60 ms
68,992 KB |
testcase_27 | AC | 60 ms
69,376 KB |
testcase_28 | AC | 60 ms
66,944 KB |
testcase_29 | AC | 639 ms
78,748 KB |
testcase_30 | AC | 60 ms
68,992 KB |
testcase_31 | AC | 703 ms
78,632 KB |
testcase_32 | AC | 632 ms
78,912 KB |
testcase_33 | AC | 679 ms
78,172 KB |
testcase_34 | AC | 735 ms
78,796 KB |
testcase_35 | AC | 632 ms
77,956 KB |
testcase_36 | AC | 669 ms
77,732 KB |
testcase_37 | AC | 721 ms
78,092 KB |
testcase_38 | AC | 674 ms
78,720 KB |
testcase_39 | AC | 676 ms
78,800 KB |
testcase_40 | AC | 697 ms
78,464 KB |
testcase_41 | AC | 668 ms
78,292 KB |
testcase_42 | AC | 634 ms
78,336 KB |
testcase_43 | AC | 651 ms
78,320 KB |
testcase_44 | AC | 688 ms
78,224 KB |
testcase_45 | AC | 687 ms
79,104 KB |
testcase_46 | AC | 715 ms
78,896 KB |
testcase_47 | AC | 673 ms
78,352 KB |
testcase_48 | AC | 718 ms
78,592 KB |
testcase_49 | AC | 674 ms
78,208 KB |
testcase_50 | AC | 722 ms
78,272 KB |
testcase_51 | AC | 56 ms
64,000 KB |
testcase_52 | AC | 53 ms
62,976 KB |
testcase_53 | AC | 53 ms
62,720 KB |
testcase_54 | AC | 41 ms
52,608 KB |
testcase_55 | AC | 41 ms
52,608 KB |
testcase_56 | AC | 40 ms
52,864 KB |
testcase_57 | AC | 61 ms
71,808 KB |
testcase_58 | AC | 63 ms
72,576 KB |
testcase_59 | AC | 64 ms
72,704 KB |
ソースコード
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) ans = 0 for i in range(n): r1, x1, y1 = rxy[i] if r1 >= 0: break s1 = atan2(-y1, -x1) l = bisect_right(rr, s1) for j in range(i+1, n): r2, x2, y2 = rxy[j] if x1*y2-y1*x2 == 0: continue if x1*y2-y1*x2 < 0: break s2 = atan2(-y2, -x2) if s2 < 0: r = n else: r = bisect_left(rr, s2) ans += r-l # print(i,j,l,r,ans) print(ans)