結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー shinshin
提出日時 2022-11-19 15:03:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 29 ms / 5,000 ms
コード長 692 bytes
コンパイル時間 716 ms
コンパイル使用メモリ 11,880 KB
実行使用メモリ 10,196 KB
最終ジャッジ日時 2023-10-20 19:41:08
合計ジャッジ時間 1,881 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,196 KB
testcase_01 AC 27 ms
10,196 KB
testcase_02 AC 27 ms
10,196 KB
testcase_03 AC 26 ms
10,196 KB
testcase_04 AC 26 ms
10,196 KB
testcase_05 AC 27 ms
10,196 KB
testcase_06 AC 29 ms
10,196 KB
testcase_07 AC 27 ms
10,196 KB
testcase_08 AC 27 ms
10,196 KB
testcase_09 AC 28 ms
10,196 KB
testcase_10 AC 27 ms
10,196 KB
testcase_11 AC 25 ms
10,196 KB
testcase_12 AC 24 ms
10,196 KB
testcase_13 AC 26 ms
10,196 KB
testcase_14 AC 26 ms
10,196 KB
testcase_15 AC 26 ms
10,196 KB
testcase_16 AC 27 ms
10,196 KB
testcase_17 AC 26 ms
10,196 KB
testcase_18 AC 28 ms
10,196 KB
testcase_19 AC 29 ms
10,196 KB
testcase_20 AC 28 ms
10,196 KB
testcase_21 AC 27 ms
10,196 KB
testcase_22 AC 27 ms
10,196 KB
testcase_23 AC 27 ms
10,196 KB
testcase_24 AC 26 ms
10,196 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#正方形を描くだけの簡単なお仕事です
#未完成

def d(d1 , d2):
    r = (d1[0] - d2[0]) ** 2 + (d1[1] - d2[1]) ** 2
    return r

xy = list(map(int , input().split()))
p1 = [xy[0] , xy[1]]
p2 = [xy[2] , xy[3]]
p3 = [xy[4] , xy[5]]

r1 = d(p1 , p2)
r2 = d(p2 , p3)
r3 = d(p3 , p1)

R = [r1 , r2 , r3]
R.sort()

if R[0] == R[1] and R[2] == R[0] + R[1]:
    x = 0
    y = 0
    if r1 == R[2]:
        x = p1[0] + (p2[0] - p3[0])
        y = p1[1] + (p2[1] - p3[1])
    elif r2 == R[2]:
        x = p2[0] + (p3[0] - p1[0])
        y = p2[1] + (p3[1] - p1[1])
    else:
        x = p3[0] + (p1[0] - p2[0])
        y = p3[1] + (p1[1] - p2[1])
    print(x , y)
else:
    print(-1)

0