結果

問題 No.3005 トレミーの問題
ユーザー tkykwtnb
提出日時 2025-01-17 22:01:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 930 bytes
コンパイル時間 187 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 84,352 KB
最終ジャッジ日時 2025-01-17 22:02:58
合計ジャッジ時間 6,893 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

from decimal import Decimal, ROUND_HALF_UP
import itertools
import math
from dataclasses import dataclass
@dataclass
class Point:
    x: int
    y: int
P=[]
e=Point(1,1)
P.append(Point(*map(int,input().split())))
P.append(Point(*map(int,input().split())))
P.append(Point(*map(int,input().split())))
P.append(Point(*map(int,input().split())))

def length(P,Q):
    return math.sqrt(abs(P.x-Q.x)**2+abs(P.y-Q.y)**2)

for a,b,c,d in itertools.permutations(range(4)):
    if (P[a].y-P[c].y)*(P[b].x-P[a].x)==(P[b].y-P[a].y)*(P[a].x-P[c].x) and \
        (P[a].y-P[c].y)*(P[d].x-P[a].x)==(P[d].y-P[a].y)*(P[a].x-P[c].x):
        continue
    l=Decimal(length(P[a],P[c])*length(P[b],P[d])).quantize(Decimal("1"), rounding=ROUND_HALF_UP)
    r=Decimal(length(P[a],P[d])*length(P[b],P[c])+length(P[a],P[b])*length(P[d],P[c])).quantize(Decimal("1"), rounding=ROUND_HALF_UP)
    if 0<=abs(l-r)<0.001:
        exit(print("YES"))
print("NO")
0