結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー r_ishida
提出日時 2025-05-06 17:18:59
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 29 ms / 5,000 ms
コード長 818 bytes
コンパイル時間 226 ms
コンパイル使用メモリ 12,160 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2025-05-06 17:19:01
合計ジャッジ時間 2,085 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

x1, y1, x2, y2, x3, y3 = MI()
d1 = (x2-x1)*(x3-x1) + (y2-y1)*(y3-y1)
d2 = (x3-x2)*(x1-x2) + (y3-y2)*(y1-y2)
d3 = (x1-x3)*(x2-x3) + (y1-y3)*(y2-y3)

f1 = (x2-x1)**2 + (y2-y1)**2 - (x3-x1)**2 - (y3-y1)**2
f2 = (x3-x2)**2 + (y3-y2)**2 - (x1-x2)**2 - (y1-y2)**2
f3 = (x1-x3)**2 + (y1-y3)**2 - (x2-x3)**2 - (y2-y3)**2

if d1 == 0 and f1 == 0:
    print(x3-x1+x2, y3-y1+y2)
elif d2 == 0 and f2 == 0:
    print(x1-x2+x3, y1-y2+y3)
elif d3 == 0 and f3 == 0:
    print(x2-x3+x1, y2-y3+y1)
else:
    print(-1)
0