結果

問題 No.2628 Shrinkage
ユーザー tassei903tassei903
提出日時 2024-02-11 17:05:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 37 ms / 2,000 ms
コード長 877 bytes
コンパイル時間 154 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 53,460 KB
最終ジャッジ日時 2024-02-16 20:50:48
合計ジャッジ時間 2,187 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,460 KB
testcase_01 AC 35 ms
53,460 KB
testcase_02 AC 36 ms
53,460 KB
testcase_03 AC 35 ms
53,460 KB
testcase_04 AC 35 ms
53,460 KB
testcase_05 AC 35 ms
53,460 KB
testcase_06 AC 35 ms
53,460 KB
testcase_07 AC 36 ms
53,460 KB
testcase_08 AC 37 ms
53,456 KB
testcase_09 AC 35 ms
53,460 KB
testcase_10 AC 35 ms
53,460 KB
testcase_11 AC 35 ms
53,460 KB
testcase_12 AC 35 ms
53,460 KB
testcase_13 AC 35 ms
53,460 KB
testcase_14 AC 35 ms
53,460 KB
testcase_15 AC 36 ms
53,460 KB
testcase_16 AC 35 ms
53,460 KB
testcase_17 AC 36 ms
53,460 KB
testcase_18 AC 35 ms
53,460 KB
testcase_19 AC 35 ms
53,460 KB
testcase_20 AC 36 ms
53,460 KB
testcase_21 AC 34 ms
53,460 KB
testcase_22 AC 34 ms
53,460 KB
testcase_23 AC 35 ms
53,460 KB
testcase_24 AC 35 ms
53,460 KB
testcase_25 AC 34 ms
53,460 KB
testcase_26 AC 34 ms
53,460 KB
testcase_27 AC 35 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes")
no = lambda :print("no");No = lambda :print("No")
#######################################################################
t = ni()

def sub(a, b):
    return (a[0] - b[0], a[1] - b[1])

def det(a, b):
    return a[0]*b[1] - a[1]*b[0]

def parallel(a, b, c, d):
    return det(sub(a, b), sub(c, d)) == 0

def norm(a):
    return a[0] ** 2 + a[1] ** 2

def dist(a, b):
    return norm(sub(a, b))

def dot(a, b):
    return a[0]*b[0] + a[1]*b[1]

for _ in range(t):
    a = na()
    p1, p2 = a[0:2], a[2:4]
    q1, q2 = a[4:6], a[6:8]
    if (parallel(p1, p2, q1, q2) and dist(p1, p2) > dist(q1, q2) and dot(sub(p1, p2), sub(q1, q2)) > 0) or (p1 == q1 and p2 == q2):
        Yes()
    else:
        No()
0