結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー Ricky_pon
提出日時 2020-05-22 09:14:11
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 908 bytes
コンパイル時間 499 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 13,760 KB
最終ジャッジ日時 2024-10-03 23:41:37
合計ジャッジ時間 106,931 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 TLE * 1
other AC * 7 TLE * 12 -- * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

import itertools

def dot(p, q):
    return p[0]*q[0] + p[1]*q[1]

def dist(p, q):
    return (p[0]-q[0])**2 + (p[1]-q[1])**2

x1, y1, x2, y2, x3, y3 = map(int, readline().split())
p = [(x1, y1), (x2, y2), (x3, y3)]

for x in range(-200, 201):
    for y in range(-200, 201):
        p.append((x, y))
        flag = True
        for a in itertools.permutations(p):
            flag = True
            for i in range(4):
                s, t, u = a[i], a[(i+1)%4], a[(i+2)%4]
                if dist(s, t) != dist(t, u):
                    flag = False
                    break
                if dot((s[0]-t[0], s[1]-t[1]), (u[0]-t[0], u[1]-t[1])) != 0:
                    flag = False
                    break
            if flag:
                print(x, y)
                quit()
        p.pop()

print(-1)
0