結果
| 問題 | No.635 自然門松列 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-05-19 04:53:18 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 234 ms / 650 ms |
| コード長 | 878 bytes |
| 記録 | |
| コンパイル時間 | 129 ms |
| コンパイル使用メモリ | 77,476 KB |
| 最終ジャッジ日時 | 2025-12-04 01:12:08 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 24 |
ソースコード
from fractions import Fraction
def is_kadomatsu(a, b, c):
return b < a < c or b < c < a or b > a > c or b > c > a
def solve():
x1, x2, x3, y1, y2, y3 = map(int, raw_input().split())
if is_kadomatsu(x1, x2, x3):
return "YES"
T = []
if y1 != y2:
T.append(Fraction(x1-x2, y2-y1))
if y2 != y3:
T.append(Fraction(x2-x3, y3-y2))
if y3 != y1:
T.append(Fraction(x3-x1, y1-y3))
d = Fraction(1, 10**18)
for t in T:
if t < 0:
continue
for sign in (1, -1):
if t == 0 and sign == -1:
continue
a1 = x1 + y1 * (t + sign * d)
a2 = x2 + y2 * (t + sign * d)
a3 = x3 + y3 * (t + sign * d)
if is_kadomatsu(a1, a2, a3):
return "YES"
return "NO"
Q = input()
for _ in xrange(Q):
print solve()