結果

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

テストケース

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

ソースコード

diff #

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()
0