結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー ゆるくゆるく
提出日時 2014-11-03 05:16:51
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 491 ms / 5,000 ms
コード長 1,056 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,520 KB
最終ジャッジ日時 2024-04-26 22:05:39
合計ジャッジ時間 10,531 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 239 ms
11,392 KB
testcase_01 AC 445 ms
11,392 KB
testcase_02 AC 236 ms
11,264 KB
testcase_03 AC 246 ms
11,264 KB
testcase_04 AC 476 ms
11,264 KB
testcase_05 AC 465 ms
11,264 KB
testcase_06 AC 483 ms
11,520 KB
testcase_07 AC 491 ms
11,392 KB
testcase_08 AC 475 ms
11,392 KB
testcase_09 AC 485 ms
11,392 KB
testcase_10 AC 482 ms
11,392 KB
testcase_11 AC 151 ms
11,392 KB
testcase_12 AC 477 ms
11,264 KB
testcase_13 AC 372 ms
11,264 KB
testcase_14 AC 262 ms
11,392 KB
testcase_15 AC 490 ms
11,520 KB
testcase_16 AC 265 ms
11,392 KB
testcase_17 AC 491 ms
11,392 KB
testcase_18 AC 147 ms
11,392 KB
testcase_19 AC 475 ms
11,392 KB
testcase_20 AC 239 ms
11,392 KB
testcase_21 AC 224 ms
11,264 KB
testcase_22 AC 476 ms
11,392 KB
testcase_23 AC 333 ms
11,264 KB
testcase_24 AC 148 ms
11,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy

xy = list(map(int, input().split()))


def is_square(square_x, square_y):
    square_v = []
    for i in range(4):
        for j in range(i + 1, 4):
            dx = square_x[i] - square_x[j]
            dy = square_y[i] - square_y[j]
            square_v.append(dx ** 2 + dy ** 2)
    square_v.sort()
    l = square_v[0]
    return square_v[0] == l and square_v[1] == l and square_v[2] == l and square_v[3] == l and square_v[4] == l * 2 and square_v[5] == l * 2
    

x = [0] * 4
y = [0] * 4

for i in range(3):
    x[i] = xy[i + i * 1]
    y[i] = xy[i + 1 * (i + 1)]

flag = False
for i in range(-200, 201):
    if flag:
        break
    for j in range(-200,201):
        x[3] = i
        y[3] = j
        if is_square(x,y):
            flag = True
            print(i,j)
            break
if flag == False:
    print(-1)
0