結果
問題 |
No.947 ABC包囲網
|
ユーザー |
![]() |
提出日時 | 2019-12-16 18:30:10 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,067 bytes |
コンパイル時間 | 773 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,776 KB |
最終ジャッジ日時 | 2024-07-02 20:22:02 |
合計ジャッジ時間 | 58,416 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 39 TLE * 21 |
ソースコード
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()