結果

問題 No.2628 Shrinkage
ユーザー ShirotsumeShirotsume
提出日時 2024-02-17 00:05:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 176 ms / 2,000 ms
コード長 1,235 bytes
コンパイル時間 257 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 88,124 KB
最終ジャッジ日時 2024-02-17 00:05:14
合計ジャッジ時間 5,954 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 145 ms
88,124 KB
testcase_01 AC 149 ms
88,124 KB
testcase_02 AC 161 ms
87,996 KB
testcase_03 AC 150 ms
88,124 KB
testcase_04 AC 148 ms
88,124 KB
testcase_05 AC 173 ms
87,996 KB
testcase_06 AC 143 ms
87,996 KB
testcase_07 AC 146 ms
87,996 KB
testcase_08 AC 149 ms
87,996 KB
testcase_09 AC 176 ms
88,124 KB
testcase_10 AC 147 ms
87,996 KB
testcase_11 AC 147 ms
88,124 KB
testcase_12 AC 147 ms
87,996 KB
testcase_13 AC 144 ms
87,996 KB
testcase_14 AC 148 ms
88,124 KB
testcase_15 AC 150 ms
88,124 KB
testcase_16 AC 155 ms
88,124 KB
testcase_17 AC 149 ms
88,124 KB
testcase_18 AC 149 ms
88,124 KB
testcase_19 AC 148 ms
87,996 KB
testcase_20 AC 149 ms
87,996 KB
testcase_21 AC 147 ms
87,996 KB
testcase_22 AC 149 ms
88,124 KB
testcase_23 AC 147 ms
88,124 KB
testcase_24 AC 145 ms
87,996 KB
testcase_25 AC 142 ms
88,124 KB
testcase_26 AC 148 ms
87,996 KB
testcase_27 AC 144 ms
87,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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 ** 61 - 1
mod = 998244353
from fractions import Fraction
def line_cross_point(P0, P1, Q0, Q1):
    x0, y0 = P0; x1, y1 = P1
    x2, y2 = Q0; x3, y3 = Q1
    a0 = x1 - x0; b0 = y1 - y0
    a2 = x3 - x2; b2 = y3 - y2

    d = a0*b2 - a2*b0
    if d == 0:
        # two lines are parallel
        return None

    # s = sn/d
    sn = b2 * (x2-x0) - a2 * (y2-y0)
    # t = tn/d
    #tn = b0 * (x2-x0) - a0 * (y2-y0)
    return x0 + Fraction(a0*sn,d), y0 + Fraction(b0*sn,d)
def solve():
    x1, y1, x2, y2, X1, Y1, X2, Y2 = mi()
    if (x1 == X1) and (y1 == Y1) and (x2 == X2) and (y2 == Y2):
        print('Yes')
        return
    elif (x1 - x2) * (Y1 - Y2) != (X1 - X2) * (y1 - y2):
        print('No')
        return
    elif (x2 - x1) ** 2 + (y2 - y1) ** 2 <= (X1 - X2) ** 2 + (Y2 - Y1) ** 2:
        print('No')
        return
    else:
        if (X1 - X2) * (x1 - x2) + (Y1 - Y2) * (y1 - y2) < 0:
           print('No')
        else:
            print('Yes') 
        
        
for _ in range(ii()):
    solve()
0