Submission #3389050
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
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][iw]
L = [[x1, y1], [x2, y2], [x3, y3]]
del L[iw]
h = d(*points2line(*L[0], *L[1]), xc, yc)
print(w*h/(2*h + w))
Submission Info
Submission Time |
|
Task |
B - Inscribed Bicycle |
User |
nagiss |
Language |
Python (3.4.3) |
Score |
0 |
Code Size |
727 Byte |
Status |
RE |
Exec Time |
17 ms |
Memory |
3064 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 500 |
Status |
|
|
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 |
RE |
17 ms |
3064 KB |
001.txt |
RE |
17 ms |
3064 KB |
002.txt |
RE |
17 ms |
3064 KB |
003.txt |
RE |
17 ms |
3064 KB |
004.txt |
RE |
17 ms |
3064 KB |
005.txt |
RE |
17 ms |
3064 KB |
006.txt |
RE |
17 ms |
3064 KB |
007.txt |
RE |
17 ms |
3064 KB |
008.txt |
RE |
17 ms |
3064 KB |
009.txt |
RE |
17 ms |
3064 KB |
010.txt |
RE |
17 ms |
3064 KB |
011.txt |
RE |
17 ms |
3064 KB |
012.txt |
RE |
17 ms |
3064 KB |
013.txt |
RE |
17 ms |
3064 KB |
014.txt |
RE |
17 ms |
3064 KB |
015.txt |
RE |
17 ms |
3064 KB |
example0.txt |
RE |
17 ms |
3064 KB |
example1.txt |
RE |
17 ms |
3064 KB |