結果
問題 |
No.635 自然門松列
|
ユーザー |
|
提出日時 | 2018-05-19 04:52:11 |
言語 | Python2 (2.7.18) |
結果 |
WA
|
実行時間 | - |
コード長 | 815 bytes |
コンパイル時間 | 225 ms |
コンパイル使用メモリ | 6,912 KB |
実行使用メモリ | 8,192 KB |
最終ジャッジ日時 | 2024-06-28 14:18:21 |
合計ジャッジ時間 | 1,699 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 21 WA * 2 |
ソースコード
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): 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()