結果
問題 | No.2602 Real Collider |
ユーザー | strangerxxx |
提出日時 | 2024-01-13 00:19:56 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,663 bytes |
コンパイル時間 | 287 ms |
コンパイル使用メモリ | 82,164 KB |
実行使用メモリ | 77,380 KB |
最終ジャッジ日時 | 2024-09-28 00:39:32 |
合計ジャッジ時間 | 12,691 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 37 ms
53,312 KB |
testcase_01 | AC | 36 ms
52,828 KB |
testcase_02 | AC | 37 ms
53,684 KB |
testcase_03 | AC | 38 ms
54,544 KB |
testcase_04 | WA | - |
testcase_05 | AC | 36 ms
53,272 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 120 ms
76,900 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 106 ms
76,552 KB |
testcase_16 | AC | 125 ms
76,544 KB |
testcase_17 | AC | 132 ms
76,776 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 144 ms
76,576 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | AC | 103 ms
76,448 KB |
testcase_27 | WA | - |
testcase_28 | AC | 129 ms
76,648 KB |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | AC | 120 ms
76,792 KB |
testcase_32 | AC | 114 ms
76,392 KB |
testcase_33 | AC | 126 ms
76,804 KB |
testcase_34 | AC | 127 ms
76,712 KB |
testcase_35 | AC | 105 ms
76,648 KB |
testcase_36 | AC | 105 ms
76,380 KB |
testcase_37 | AC | 131 ms
76,800 KB |
testcase_38 | AC | 128 ms
76,680 KB |
testcase_39 | AC | 133 ms
76,588 KB |
testcase_40 | AC | 102 ms
76,380 KB |
testcase_41 | AC | 141 ms
76,640 KB |
testcase_42 | AC | 125 ms
76,416 KB |
testcase_43 | AC | 135 ms
76,452 KB |
testcase_44 | AC | 138 ms
76,952 KB |
testcase_45 | AC | 115 ms
76,760 KB |
testcase_46 | AC | 108 ms
76,344 KB |
testcase_47 | AC | 127 ms
76,564 KB |
testcase_48 | AC | 118 ms
76,512 KB |
testcase_49 | AC | 114 ms
76,728 KB |
testcase_50 | AC | 103 ms
76,576 KB |
testcase_51 | AC | 105 ms
76,632 KB |
testcase_52 | AC | 99 ms
76,284 KB |
testcase_53 | AC | 122 ms
76,600 KB |
testcase_54 | AC | 114 ms
76,512 KB |
testcase_55 | AC | 122 ms
76,328 KB |
testcase_56 | AC | 120 ms
77,076 KB |
testcase_57 | AC | 111 ms
76,728 KB |
testcase_58 | AC | 92 ms
76,404 KB |
testcase_59 | AC | 121 ms
76,468 KB |
testcase_60 | AC | 115 ms
76,512 KB |
testcase_61 | AC | 111 ms
76,980 KB |
testcase_62 | AC | 126 ms
77,100 KB |
testcase_63 | AC | 134 ms
76,864 KB |
testcase_64 | AC | 138 ms
76,844 KB |
testcase_65 | AC | 108 ms
76,708 KB |
testcase_66 | AC | 132 ms
76,588 KB |
testcase_67 | AC | 99 ms
76,556 KB |
testcase_68 | AC | 104 ms
76,636 KB |
testcase_69 | AC | 99 ms
76,264 KB |
testcase_70 | AC | 98 ms
76,756 KB |
testcase_71 | AC | 108 ms
76,604 KB |
testcase_72 | AC | 127 ms
76,656 KB |
testcase_73 | AC | 116 ms
76,952 KB |
testcase_74 | AC | 129 ms
76,644 KB |
testcase_75 | AC | 135 ms
77,196 KB |
testcase_76 | AC | 128 ms
76,840 KB |
testcase_77 | AC | 129 ms
76,852 KB |
testcase_78 | AC | 140 ms
76,680 KB |
testcase_79 | AC | 129 ms
76,516 KB |
testcase_80 | AC | 136 ms
76,448 KB |
ソースコード
def resolve(): import sys input = sys.stdin.readline q = int(input()) xa, ya, xb, yb, xc, yc = map(int, input().split()) delta = 1e-10 try: c = circumcenter((xa, ya), (xb, yb), (xc, yc)) d = distance(c, (xa, ya)) + delta except ValueError: a = sorted([xa, xb, xc]) b = sorted([ya, yb, yc]) if xa != xc: d = (a[-1] - a[0]) / 2 c = (a[0] + d, b[0]) else: d = (b[-1] - b[0]) / 2 c = (a[0], b[0] + d) for _ in range(q): x, y = map(int, input().split()) print("Yes" if distance(c, (x, y)) <= d else "No") def circumcenter(pa, pb, pc, ignore=False): # 外心 a, b, c = side_length(pa, pb, pc) try: return barycentric_coordinate( pa, pb, pc, sin_a(a, b, c) * cos_a(a, b, c), sin_a(b, c, a) * cos_a(b, c, a), sin_a(c, a, b) * cos_a(c, a, b), ignore, ) except: if ignore: return [] else: raise ValueError("points on a straight line") def barycentric_coordinate(pa, pb, pc, ga, gb, gc, ignore=False): # △BCP:△CAP:△ABP=ga:gb:gcであるときの点Pの座標 try: g = ga + gb + gc return [(a * ga + b * gb + c * gc) / g for a, b, c in zip(pa, pb, pc)] except: if ignore: return [] else: raise ValueError("points on a straight line") def side_length(pa, pb, pc): # 3辺の長さ return distance(pc, pb), distance(pa, pc), distance(pa, pb) def area(a, b, c): # 面積 s = (a + b + c) / 2 return (s * (s - a) * (s - b) * (s - c)) ** 0.5 def sin_a(a, b, c): # sin∠BAC s = area(a, b, c) return max(min(s * 2 / b / c, 1), -1) def cos_a(a, b, c): # cos∠BAC return max(min((b**2 + c**2 - a**2) / (2 * b * c), 1), -1) def sin_o(pa, pb): # sin∠AOB a, b, c = side_length([0] * len(pa), pa, pb) return sin_a(a, b, c) def cos_o(pa, pb): # cos∠AOB a, b, c = side_length([0] * len(pa), pa, pb) return cos_a(a, b, c) def sin_t(pa, pb, pc): # 3つの角のsin a, b, c = side_length(pa, pb, pc) s = area(a, b, c) return s * 2 / b / c, s * 2 / c / a, s * 2 / a / b def cos_t(pa, pb, pc): # 3つの角のcos a, b, c = side_length(pa, pb, pc) return cos_a(a, b, c), cos_a(b, c, a), cos_a(c, a, b) def distance(pa, pb): return sum([(i - j) ** 2 for i, j in zip(pa, pb)]) ** 0.5 def midpoint(pa, pb): return [(x + y) / 2 for x, y in zip(pa, pb)] if __name__ == "__main__": resolve()