結果
問題 |
No.635 自然門松列
|
ユーザー |
![]() |
提出日時 | 2018-03-10 02:05:37 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 921 bytes |
コンパイル時間 | 165 ms |
コンパイル使用メモリ | 81,528 KB |
実行使用メモリ | 82,632 KB |
最終ジャッジ日時 | 2024-10-11 06:05:55 |
合計ジャッジ時間 | 5,447 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 4 WA * 19 |
ソースコード
from decimal import * def solve(a,b,c,d,e,f): sa=a-c sb=b-d ta=e-c tb=f-d # if there are any x>0 which makes s*t>0, it is answer. # (sa*x+sb)*(ta*x+tb)=Ax^2+Bx+C>0 A=sa*ta B=sa*tb+sb*ta C=sb*tb if A<Decimal(0): A*=-1 B*=-1 C*=-1 if A>Decimal(0): # x=inf then f>0.OK return True elif A==Decimal(0): # f=Bx+C,C>0 or B>0 then OK. return C>Decimal(0) or B>Decimal(0) else: if B*B<4*A*C: return False # we can find two answers(suppose it's p and q). # if [p,q] contains positive number, is's OK. # => q=(-B+sqrt(B**2 - 4AC))/(2A)>0 return (-B+(B*B-4*A*C).sqrt())/(2*A)>Decimal(0) n=int(input()) for i in range(n): dat=list(map(Decimal,input().split())) if solve(dat[3],dat[0],dat[4],dat[1],dat[5],dat[2]): print("YES") else: print("NO")