結果

問題 No.635 自然門松列
ユーザー maspymaspy
提出日時 2020-03-03 09:48:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 37 ms / 650 ms
コード長 987 bytes
コンパイル時間 197 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-21 23:21:04
合計ジャッジ時間 1,979 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#!/usr/bin/env python3
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


# %%
N = int(readline())
m = map(int, read().split())
query = list(zip(m, m, m, m, m, m))

# %%
eps = 1e-9


# %%
def solve(x1, x2, x3, y1, y2, y3):
    T = [0]
    if y1 != y2:
        t = (x2 - x1) / (y1 - y2)
        if t > eps:
            T.append(t)
    if y1 != y3:
        t = (x3 - x1) / (y1 - y3)
        if t > eps:
            T.append(t)
    if y3 != y2:
        t = (x2 - x3) / (y3 - y2)
        if t > eps:
            T.append(t)
    T.sort()
    T.append(T[-1] + 1)
    for t1, t2 in zip(T, T[1:]):
        t = (t1 + t2) / 2
        a1 = x1 + t * y1
        a2 = x2 + t * y2
        a3 = x3 + t * y3
        if a1 < a2 - eps > a3 and abs(a1 - a3) > eps:
            return 'YES'
        if a1 > a2 + eps < a3 and abs(a1 - a3) > eps:
            return 'YES'
    return 'NO'


# %%
print('\n'.join(solve(*q) for q in query))
0