Archers and the Monster

Hasinur_ PIHACKS'21-CodeJam
Limits 1s, 512 MB

A monster is trapped in a triangle in a 2D coordinate system. Three archers are waiting to kill him. Each of the archers is waiting for the right moment standing on the sides of the triangle. No two archers will stand on the same side of the triangle. They can move along the sides they are standing on. The monster can not escape the triangle. It can only move within the area of the triangle.

The right moment is when the monster and the archers have moved to positions such that the shortest Euclidean distance between each of the archers and monster is the same. You will be given the length of the sides. You have to calculate the shortest possible Euclidean distance.


The first line of the test case contains a single integer TT which denotes the number of test cases. Each of the next TT lines will contain three space-separated integers aa, bb and cc which denote the length of the sides of the triangle. It is guaranteed that the triangle is a non-degenerated triangle.


For 10 points:

  • 1T1001 \leq T \leq 100

  • 1a,b,c1001 \leq a, b,c \leq 100

  • a=b=ca = b = c

For 90 points:

  • 1T5000501\leq T \leq 500050

  • 1a,b,c1001 \leq a,b,c \leq 100


For each case, print the shortest distance. Errors less than 10410^{-4} will be ignored.


1 1 1
9 8 4
16 14 22


Login to submit.


88% Solution Ratio
silenced.VOICEEarliest, Jul '21
salman.exeFastest, 0.2s
Mestu_PaulLightest, 3.9 MB
fragilisticShortest, 261B
Toph uses cookies. By continuing you agree to our Cookie Policy.