結果
問題 | No.2602 Real Collider |
ユーザー | strangerxxx |
提出日時 | 2024-01-13 00:14:49 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 2,406 bytes |
コンパイル時間 | 254 ms |
コンパイル使用メモリ | 82,196 KB |
実行使用メモリ | 77,568 KB |
最終ジャッジ日時 | 2024-09-28 00:34:48 |
合計ジャッジ時間 | 12,342 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 37 ms
52,736 KB |
testcase_01 | RE | - |
testcase_02 | AC | 38 ms
52,736 KB |
testcase_03 | AC | 38 ms
53,376 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 121 ms
76,412 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 109 ms
76,384 KB |
testcase_16 | AC | 130 ms
76,928 KB |
testcase_17 | AC | 129 ms
76,520 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | AC | 113 ms
76,276 KB |
testcase_27 | WA | - |
testcase_28 | AC | 129 ms
76,416 KB |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | AC | 125 ms
76,964 KB |
testcase_32 | AC | 125 ms
76,672 KB |
testcase_33 | AC | 130 ms
76,592 KB |
testcase_34 | AC | 127 ms
76,652 KB |
testcase_35 | AC | 111 ms
76,416 KB |
testcase_36 | AC | 111 ms
76,204 KB |
testcase_37 | AC | 125 ms
76,484 KB |
testcase_38 | AC | 131 ms
76,660 KB |
testcase_39 | AC | 127 ms
77,056 KB |
testcase_40 | AC | 103 ms
75,948 KB |
testcase_41 | AC | 131 ms
76,540 KB |
testcase_42 | AC | 121 ms
77,144 KB |
testcase_43 | AC | 128 ms
76,544 KB |
testcase_44 | AC | 132 ms
77,140 KB |
testcase_45 | AC | 115 ms
76,188 KB |
testcase_46 | AC | 113 ms
76,840 KB |
testcase_47 | AC | 125 ms
77,112 KB |
testcase_48 | AC | 120 ms
76,544 KB |
testcase_49 | AC | 113 ms
76,416 KB |
testcase_50 | AC | 104 ms
76,444 KB |
testcase_51 | AC | 108 ms
76,392 KB |
testcase_52 | AC | 98 ms
76,800 KB |
testcase_53 | AC | 125 ms
76,544 KB |
testcase_54 | AC | 111 ms
76,800 KB |
testcase_55 | AC | 122 ms
76,536 KB |
testcase_56 | AC | 116 ms
76,800 KB |
testcase_57 | AC | 126 ms
76,520 KB |
testcase_58 | AC | 100 ms
76,532 KB |
testcase_59 | AC | 130 ms
76,672 KB |
testcase_60 | AC | 123 ms
76,492 KB |
testcase_61 | AC | 115 ms
76,160 KB |
testcase_62 | AC | 132 ms
76,392 KB |
testcase_63 | WA | - |
testcase_64 | AC | 142 ms
76,788 KB |
testcase_65 | AC | 112 ms
76,288 KB |
testcase_66 | WA | - |
testcase_67 | AC | 107 ms
76,368 KB |
testcase_68 | AC | 114 ms
76,008 KB |
testcase_69 | AC | 102 ms
76,416 KB |
testcase_70 | AC | 101 ms
76,416 KB |
testcase_71 | AC | 109 ms
76,416 KB |
testcase_72 | AC | 121 ms
77,016 KB |
testcase_73 | AC | 114 ms
76,704 KB |
testcase_74 | AC | 124 ms
76,888 KB |
testcase_75 | AC | 127 ms
76,800 KB |
testcase_76 | AC | 124 ms
76,544 KB |
testcase_77 | AC | 122 ms
76,656 KB |
testcase_78 | AC | 134 ms
76,852 KB |
testcase_79 | AC | 127 ms
76,288 KB |
testcase_80 | AC | 132 ms
76,416 KB |
ソースコード
def resolve(): import sys input = sys.stdin.readline MOD = 1000000007 q = int(input()) xa, ya, xb, yb, xc, yc = map(int, input().split()) c = circumcenter((xa, ya), (xb, yb), (xc, yc)) delta = 1e-6 d = distance(c, (xa, ya)) for _ in range(q): x, y = map(int, input().split()) print("Yes" if distance(c, (x, y)) - delta <= 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()