結果

問題 No.635 自然門松列
ユーザー maspy
提出日時 2020-03-03 09:48:23
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 30 ms / 650 ms
コード長 987 bytes
コンパイル時間 349 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-10-13 21:48:45
合計ジャッジ時間 1,817 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

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