結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー dangodango
提出日時 2023-07-06 21:41:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 66 ms / 5,000 ms
コード長 651 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 87,212 KB
実行使用メモリ 71,692 KB
最終ジャッジ日時 2023-09-27 22:39:27
合計ジャッジ時間 3,297 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,524 KB
testcase_01 AC 65 ms
71,472 KB
testcase_02 AC 64 ms
71,364 KB
testcase_03 AC 64 ms
71,444 KB
testcase_04 AC 66 ms
71,692 KB
testcase_05 AC 63 ms
71,452 KB
testcase_06 AC 66 ms
71,460 KB
testcase_07 AC 66 ms
71,348 KB
testcase_08 AC 65 ms
71,512 KB
testcase_09 AC 64 ms
71,348 KB
testcase_10 AC 65 ms
71,204 KB
testcase_11 AC 65 ms
71,204 KB
testcase_12 AC 63 ms
71,324 KB
testcase_13 AC 65 ms
71,384 KB
testcase_14 AC 65 ms
71,688 KB
testcase_15 AC 63 ms
71,340 KB
testcase_16 AC 64 ms
71,496 KB
testcase_17 AC 65 ms
71,348 KB
testcase_18 AC 65 ms
71,456 KB
testcase_19 AC 63 ms
71,552 KB
testcase_20 AC 65 ms
71,452 KB
testcase_21 AC 64 ms
71,484 KB
testcase_22 AC 65 ms
71,636 KB
testcase_23 AC 64 ms
71,192 KB
testcase_24 AC 65 ms
71,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations

def check(p1, p2, p3):
    x1, y1 = p1
    x2, y2 = p2
    x3, y3 = p3
    if (x1 - x2) ** 2 + (y1 - y2) ** 2 == (x3 - x2) ** 2 + (y3 - y2) ** 2 and (x1 - x2) * (x3 - x2) + (y1 - y2) * (y3 - y2) == 0:
        return x1 + x3 - x2, y1 + y3 - y2
    else:
        return None

def func(x, y):
    if x is None and y is None:
        return None
    elif x is None:
        return y
    else:
        return x

x1, y1, x2, y2, x3, y3 = map(int, input().split())
p = None
for perm in permutations([(x1, y1), (x2, y2), (x3, y3)]):
    p = func(p, check(*perm))
if p is not None:
    print(p[0], p[1])
else:
    print(-1)
0