結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー 👑 KazunKazun
提出日時 2020-05-31 18:13:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 42 ms / 5,000 ms
コード長 806 bytes
コンパイル時間 542 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 52,480 KB
最終ジャッジ日時 2024-04-29 00:44:52
合計ジャッジ時間 2,280 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
51,968 KB
testcase_01 AC 39 ms
51,968 KB
testcase_02 AC 39 ms
52,224 KB
testcase_03 AC 38 ms
52,224 KB
testcase_04 AC 39 ms
52,096 KB
testcase_05 AC 41 ms
52,352 KB
testcase_06 AC 39 ms
51,840 KB
testcase_07 AC 39 ms
52,096 KB
testcase_08 AC 40 ms
52,480 KB
testcase_09 AC 41 ms
52,352 KB
testcase_10 AC 41 ms
52,096 KB
testcase_11 AC 39 ms
52,352 KB
testcase_12 AC 41 ms
52,352 KB
testcase_13 AC 40 ms
52,224 KB
testcase_14 AC 39 ms
52,480 KB
testcase_15 AC 39 ms
52,480 KB
testcase_16 AC 39 ms
52,224 KB
testcase_17 AC 40 ms
51,968 KB
testcase_18 AC 41 ms
51,968 KB
testcase_19 AC 39 ms
52,352 KB
testcase_20 AC 40 ms
51,968 KB
testcase_21 AC 40 ms
52,352 KB
testcase_22 AC 41 ms
52,224 KB
testcase_23 AC 40 ms
52,096 KB
testcase_24 AC 40 ms
52,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

class Vector2():
    def __init__(self,x=0,y=0):
        self.x=x
        self.y=y

    def __neg__(self):
        return Vector2(-self.x,-self.y)
    
    def __add__(self,other):
        v=Vector2()
        v.x=self.x+other.x
        v.y=self.y+other.y
        return v

    def __sub__(self,other):
        return self+(-other)

    def inner(u,v):
        return u.x*v.x+u.y*v.y

    def __str__(self):
        return "{} {}".format(self.x,self.y)

X=[0,0,0]
Y=[0,0,0]
X[0],Y[0],X[1],Y[1],X[2],Y[2]=map(int,input().split())

V=[]
for k in range(3):
    V.append(Vector2(X[k],Y[k]))

f=0
for i in range(3):
    j=(i+1)%3
    k=(i-1)%3

    u,v,w=V[i],V[j],V[k]
    
    if (f==0) and ((v-u).inner(v-u)==(w-u).inner(w-u)) and (v-u).inner(w-u)==0:
        f=1
        print(-u+v+w)

if f==0:
    print(-1)
0