結果

問題 No.2602 Real Collider
ユーザー ShirotsumeShirotsume
提出日時 2024-01-12 21:50:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 972 ms / 2,000 ms
コード長 1,734 bytes
コンパイル時間 476 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 94,592 KB
最終ジャッジ日時 2024-01-12 21:51:37
合計ジャッジ時間 41,894 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
87,948 KB
testcase_01 AC 138 ms
87,948 KB
testcase_02 AC 138 ms
87,948 KB
testcase_03 AC 143 ms
87,948 KB
testcase_04 AC 138 ms
87,948 KB
testcase_05 AC 165 ms
87,948 KB
testcase_06 AC 137 ms
87,948 KB
testcase_07 AC 138 ms
87,948 KB
testcase_08 AC 138 ms
87,948 KB
testcase_09 AC 140 ms
87,948 KB
testcase_10 AC 972 ms
94,592 KB
testcase_11 AC 534 ms
91,268 KB
testcase_12 AC 343 ms
90,636 KB
testcase_13 AC 272 ms
90,380 KB
testcase_14 AC 327 ms
90,764 KB
testcase_15 AC 484 ms
90,756 KB
testcase_16 AC 578 ms
91,652 KB
testcase_17 AC 662 ms
91,908 KB
testcase_18 AC 284 ms
90,508 KB
testcase_19 AC 315 ms
90,508 KB
testcase_20 AC 576 ms
91,404 KB
testcase_21 AC 293 ms
90,636 KB
testcase_22 AC 309 ms
90,508 KB
testcase_23 AC 280 ms
90,252 KB
testcase_24 AC 325 ms
90,636 KB
testcase_25 AC 294 ms
90,508 KB
testcase_26 AC 324 ms
90,892 KB
testcase_27 AC 309 ms
90,636 KB
testcase_28 AC 393 ms
90,636 KB
testcase_29 AC 296 ms
90,636 KB
testcase_30 AC 327 ms
90,508 KB
testcase_31 AC 593 ms
91,524 KB
testcase_32 AC 521 ms
91,144 KB
testcase_33 AC 589 ms
91,528 KB
testcase_34 AC 643 ms
92,432 KB
testcase_35 AC 460 ms
90,628 KB
testcase_36 AC 327 ms
90,636 KB
testcase_37 AC 604 ms
91,652 KB
testcase_38 AC 641 ms
91,784 KB
testcase_39 AC 605 ms
91,652 KB
testcase_40 AC 436 ms
90,504 KB
testcase_41 AC 659 ms
92,040 KB
testcase_42 AC 592 ms
92,036 KB
testcase_43 AC 510 ms
91,420 KB
testcase_44 AC 679 ms
92,168 KB
testcase_45 AC 535 ms
91,528 KB
testcase_46 AC 508 ms
91,008 KB
testcase_47 AC 654 ms
91,784 KB
testcase_48 AC 552 ms
91,272 KB
testcase_49 AC 486 ms
90,880 KB
testcase_50 AC 443 ms
90,504 KB
testcase_51 AC 452 ms
91,524 KB
testcase_52 AC 402 ms
90,520 KB
testcase_53 AC 606 ms
91,656 KB
testcase_54 AC 501 ms
91,024 KB
testcase_55 AC 567 ms
91,408 KB
testcase_56 AC 546 ms
91,276 KB
testcase_57 AC 531 ms
91,140 KB
testcase_58 AC 390 ms
91,520 KB
testcase_59 AC 570 ms
91,392 KB
testcase_60 AC 485 ms
91,040 KB
testcase_61 AC 518 ms
92,296 KB
testcase_62 AC 632 ms
91,912 KB
testcase_63 AC 640 ms
92,720 KB
testcase_64 AC 711 ms
92,420 KB
testcase_65 AC 493 ms
91,144 KB
testcase_66 AC 601 ms
91,784 KB
testcase_67 AC 442 ms
90,632 KB
testcase_68 AC 463 ms
91,148 KB
testcase_69 AC 419 ms
91,664 KB
testcase_70 AC 451 ms
90,760 KB
testcase_71 AC 459 ms
91,012 KB
testcase_72 AC 585 ms
91,524 KB
testcase_73 AC 547 ms
91,272 KB
testcase_74 AC 564 ms
91,524 KB
testcase_75 AC 646 ms
92,036 KB
testcase_76 AC 555 ms
91,524 KB
testcase_77 AC 566 ms
92,040 KB
testcase_78 AC 662 ms
91,908 KB
testcase_79 AC 661 ms
92,940 KB
testcase_80 AC 668 ms
93,076 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import fractions
import sys, time, random
from collections import deque, Counter, defaultdict
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353
from fractions import Fraction

n = 3
q = ii()
x1, y1, x2, y2, x3, y3 = mi()
xy = [[x1, y1], [x2, y2], [x3, y3]]


#三角形
ans = inf
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            a, b = xy[i]
            c, d = xy[j]
            e, f = xy[k]
            if a == c == e or b == d == f:
                continue
            py = Fraction(((e - a) * (a * a + b * b - c * c - d * d) - (c - a) * (a * a + b * b - e * e - f * f)), (2 * (e - a) * (b - d) - 2 * (c - a) * (b - f)))
            
            if c == a:
                px = Fraction((2 * (b - f) * py - a * a - b * b + e * e + f * f), (2 * (e - a)))
            else:
                px = Fraction((2 * (b - d) * py - a * a - b * b + c * c + d * d), (2 * (c - a)))
            r = 0
            for to in range(n):
                r = max(r, (px - xy[to][0]) ** 2 + (py - xy[to][1]) ** 2)
            if ans > r:
                X, Y = px, py
                ans = min(ans, r)

for i in range(n):
    for j in range(i + 1, n):
        a, b = xy[i]
        c, d = xy[j]
        px = Fraction((a + c),2)
        py = Fraction((b + d),2)
        r = 0
        for to in range(n):
            r = max(r, (px - xy[to][0]) ** 2 + (py - xy[to][1]) ** 2)
        if ans > r:
            X, Y = px, py
            ans = min(ans, r)
r = ans
for _ in range(q):
    x, y = mi()
    if (X - x) ** 2 + (Y - y) ** 2 <= r:
        print('Yes')
    else:
        print('No')
    
0