結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー takakin
提出日時 2020-05-07 23:39:20
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 31 ms / 5,000 ms
コード長 435 bytes
コンパイル時間 110 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-07-03 09:40:46
合計ジャッジ時間 1,676 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
x1,y1,x2,y2,x3,y3=map(int,input().split())

P=[[x1,y1],[x2,y2],[x3,y3]]

def f(Q1,Q2,Q3):
  if Q2[0]-Q1[0]==Q3[1]-Q1[1] and Q2[1]-Q1[1]==-(Q3[0]-Q1[0]):
    return [Q3[0]+Q2[0]-Q1[0],Q3[1]+Q2[1]-Q1[1]]
  else:
    return False
import itertools
for P1,P2,P3 in itertools.permutations(P,3):
  if f(P1,P2,P3):
    print(*f(P1,P2,P3))
    break
  else:
    continue
else:
  print(-1)
0