結果

問題 No.2602 Real Collider
ユーザー strangerxxxstrangerxxx
提出日時 2024-01-13 00:21:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 2,719 bytes
コンパイル時間 236 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 77,064 KB
最終ジャッジ日時 2024-01-13 00:21:32
合計ジャッジ時間 12,925 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,588 KB
testcase_01 AC 37 ms
53,588 KB
testcase_02 AC 34 ms
53,588 KB
testcase_03 AC 35 ms
53,588 KB
testcase_04 WA -
testcase_05 AC 32 ms
53,588 KB
testcase_06 AC 34 ms
53,588 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 116 ms
76,424 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 136 ms
76,552 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 125 ms
76,552 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 113 ms
76,424 KB
testcase_33 AC 123 ms
76,424 KB
testcase_34 AC 116 ms
76,424 KB
testcase_35 AC 98 ms
76,296 KB
testcase_36 WA -
testcase_37 AC 123 ms
76,552 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 102 ms
76,168 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 118 ms
76,424 KB
testcase_44 AC 133 ms
76,552 KB
testcase_45 AC 110 ms
76,296 KB
testcase_46 WA -
testcase_47 AC 126 ms
76,424 KB
testcase_48 WA -
testcase_49 AC 109 ms
76,296 KB
testcase_50 WA -
testcase_51 AC 101 ms
76,296 KB
testcase_52 AC 95 ms
76,168 KB
testcase_53 WA -
testcase_54 AC 108 ms
76,296 KB
testcase_55 WA -
testcase_56 AC 115 ms
76,424 KB
testcase_57 AC 120 ms
76,424 KB
testcase_58 AC 87 ms
76,168 KB
testcase_59 AC 120 ms
76,424 KB
testcase_60 AC 111 ms
76,424 KB
testcase_61 WA -
testcase_62 AC 125 ms
76,424 KB
testcase_63 WA -
testcase_64 AC 140 ms
76,680 KB
testcase_65 AC 105 ms
76,296 KB
testcase_66 WA -
testcase_67 WA -
testcase_68 AC 107 ms
76,296 KB
testcase_69 AC 92 ms
76,168 KB
testcase_70 WA -
testcase_71 AC 104 ms
76,296 KB
testcase_72 WA -
testcase_73 WA -
testcase_74 WA -
testcase_75 AC 136 ms
76,424 KB
testcase_76 WA -
testcase_77 WA -
testcase_78 AC 134 ms
76,552 KB
testcase_79 AC 121 ms
76,424 KB
testcase_80 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def resolve():
    import sys

    input = sys.stdin.readline
    q = int(input())
    xa, ya, xb, yb, xc, yc = map(int, input().split())
    delta = 1e-14
    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 + delta
            c = (a[0] + d, b[0])
        else:
            d = (b[-1] - b[0]) / 2 + delta
            c = (a[0], b[0] + d)
    for _ in range(q):
        x, y = map(int, input().split())
        # print(distance(c, (x, y)), d)
        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()
0