結果
問題 | No.947 ABC包囲網 |
ユーザー | mkawa2 |
提出日時 | 2021-03-18 18:50:34 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,910 bytes |
コンパイル時間 | 788 ms |
コンパイル使用メモリ | 82,328 KB |
実行使用メモリ | 158,592 KB |
最終ジャッジ日時 | 2024-11-16 22:04:59 |
合計ジャッジ時間 | 75,887 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 37 ms
58,112 KB |
testcase_01 | AC | 38 ms
130,176 KB |
testcase_02 | AC | 38 ms
57,856 KB |
testcase_03 | AC | 39 ms
131,584 KB |
testcase_04 | AC | 39 ms
57,728 KB |
testcase_05 | AC | 39 ms
130,560 KB |
testcase_06 | AC | 37 ms
57,984 KB |
testcase_07 | AC | 38 ms
130,816 KB |
testcase_08 | AC | 37 ms
57,600 KB |
testcase_09 | AC | 38 ms
131,200 KB |
testcase_10 | AC | 37 ms
57,600 KB |
testcase_11 | AC | 38 ms
131,456 KB |
testcase_12 | AC | 43 ms
63,616 KB |
testcase_13 | AC | 39 ms
132,352 KB |
testcase_14 | AC | 38 ms
57,984 KB |
testcase_15 | AC | 260 ms
157,312 KB |
testcase_16 | AC | 116 ms
82,176 KB |
testcase_17 | AC | 221 ms
156,160 KB |
testcase_18 | AC | 258 ms
83,584 KB |
testcase_19 | AC | 243 ms
158,592 KB |
testcase_20 | AC | 231 ms
82,304 KB |
testcase_21 | AC | 228 ms
156,800 KB |
testcase_22 | AC | 235 ms
82,944 KB |
testcase_23 | AC | 256 ms
157,056 KB |
testcase_24 | AC | 254 ms
83,584 KB |
testcase_25 | AC | 248 ms
156,800 KB |
testcase_26 | AC | 244 ms
83,840 KB |
testcase_27 | AC | 264 ms
158,336 KB |
testcase_28 | TLE | - |
testcase_29 | TLE | - |
testcase_30 | TLE | - |
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 | 182 ms
77,056 KB |
testcase_52 | AC | 185 ms
77,312 KB |
testcase_53 | AC | 184 ms
77,568 KB |
testcase_54 | AC | 49 ms
61,312 KB |
testcase_55 | AC | 51 ms
61,184 KB |
testcase_56 | AC | 38 ms
52,480 KB |
testcase_57 | AC | 255 ms
77,952 KB |
testcase_58 | AC | 234 ms
77,952 KB |
testcase_59 | AC | 235 ms
157,440 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 class v: def __init__(self, x, y): self.x = x self.y = y def zone(self, v): x = v.x y = v.y if x > 0 and y >= 0: return 1 if x <= 0 and y > 0: return 2 if x < 0 and y <= 0: return 3 return 4 def rev(self): return v(-self.x, -self.y) def __mul__(self, other): return self.x*other.y-self.y*other.x def __eq__(self, other): return self*other == 0 and self.zone(self) == self.zone(other) def __lt__(self, other): z1 = self.zone(self) z2 = self.zone(other) if z1 < z2: return True if z1 > z2: return False return self*other > 0 def __repr__(self): return f"({self.x},{self.y})" from bisect import * n = II() vv = [] for _ in range(n): x, y = LI() vv.append(v(x, y)) vv.sort() # print(vv) ans = 0 for j in range(n): for i in range(j): v1 = vv[i].rev() v2 = vv[j].rev() if v1*v2 == 0: continue if v1*v2 < 0: v1, v2 = v2, v1 l = bisect_right(vv, v1) r = bisect_left(vv, v2) if l <= r: ans += r-l else: ans += n-l+r # print(v1, v2, l, r, ans) print(ans//3)