Submission #3389089


Source Code Expand

def norm(x1, y1, x2, y2):
    return ((x1-x2)**2 + (y1-y2)**2)**0.5
def d(a, b, c, x, y):
    return abs(a*x + b*y + c) / (a**2 + b**2)**0.5
def points2line(x1, y1, x2, y2):
    la = y1 - y2
    lb = x2 - x1
    lc = x1 * (y2 - y1) + y1 * (x1 - x2)
    return la, lb, lc
from numpy import argmax
#def argmax(L):
#    return max(enumerate(L), key=lambda x: x[1])[0]

x1, y1 = map(int, input().split())
x2, y2 = map(int, input().split())
x3, y3 = map(int, input().split())

a = norm(x3, y3, x2, y2)
b = norm(x1, y1, x3, y3)
c = norm(x1, y1, x2, y2)

xc = (a*x1 + b*x2 + c*x3)/(a+b+c)
yc = (a*y1 + b*y2 + c*y3)/(a+b+c)

iw = argmax([a, b, c])
w = [a, b, c][int(iw)]

L = [[x1, y1], [x2, y2], [x3, y3]]
del L[int(iw)]
m, n = L[0]
p, q = L[1]
s, t, u = points2line(m, n, p, q)
h = d(s, t, u, xc, yc)
print(w*h/(2*h + w))

Submission Info

Submission Time
Task B - Inscribed Bicycle
User nagiss
Language Python (3.4.3)
Score 500
Code Size 850 Byte
Status AC
Exec Time 171 ms
Memory 13564 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 2
AC × 18
Set Name Test Cases
Sample example0.txt, example1.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, example0.txt, example1.txt
Case Name Status Exec Time Memory
000.txt AC 171 ms 13564 KB
001.txt AC 147 ms 12484 KB
002.txt AC 147 ms 12512 KB
003.txt AC 147 ms 12512 KB
004.txt AC 147 ms 12512 KB
005.txt AC 147 ms 12512 KB
006.txt AC 146 ms 12512 KB
007.txt AC 147 ms 12512 KB
008.txt AC 146 ms 12484 KB
009.txt AC 147 ms 12480 KB
010.txt AC 146 ms 12484 KB
011.txt AC 146 ms 12480 KB
012.txt AC 148 ms 12480 KB
013.txt AC 149 ms 12480 KB
014.txt AC 146 ms 12512 KB
015.txt AC 149 ms 12512 KB
example0.txt AC 148 ms 12480 KB
example1.txt AC 148 ms 12480 KB