## TLE '16 Contest 6 (Mock CCC) S2 - Paper Stapling

View as PDF

Points: 10 (partial)
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
William takes the first page of the CCC (top image) and turns it over (bottom image). Note the missing corner in the top left of the page, caused by the stapling.

The top computer scientists in Canada have just started the Canadian Computing Cancer (CCC), but Jason and William experience a huge problem. As it turns out, the CCC booklets are so poorly stapled that some words on the top left corner of the page cannot be read. Important pieces of info are cut off due to the stapling, such as the name of the problem's protagonist. The CCC cannot provide a PDF version of the problems because those who start late would have an unfair advantage.

Due to this issue, William measures the endpoints of the staples to be at distinct points and where is at the top left corner of the contest package. The x-coordinate increases infinitely as one moves right, and the y-coordinate increases infinitely as one moves down. In order to start the contest, he folds over the first page and makes a crease in a way that maximizes the amount of legible space on the second page. Jason looks at the page and notices that the missing region of the paper forms a right-angled triangle.

What area of paper is left illegible on William's page?

#### Input Specification

The first line will contain two space-separated integers and .

The second line will contain two space-separated integers and .

The coordinates are distinct points, i.e., .

For 3 of the 15 points, all coordinates will not exceed .

For an additional 3 of the 15 points, and .

#### Output Specification

Print out the area of paper missing from William's page. An absolute or relative error of will be considered correct.

#### Sample Input 1

6 1
1 5

#### Sample Output 1

21.025000000

#### Sample Input 2

1 1
3 7

#### Sample Output 2

42.000000000

• commented on July 22, 2017, 4:20 p.m.

Am I missing something?

I'm fairly certain I've taken all possible staples into account, yet I can't get test cases 3, 4, or 5.

• commented on Feb. 20, 2017, 8:54 p.m.

Java outputs large doubles in scientific notation. Will this be accepted by the judge?

• commented on Feb. 20, 2017, 8:54 p.m.

Yes.

• commented on Feb. 20, 2017, 5:49 p.m.

How is sample test case2 even possible?

• commented on Feb. 20, 2017, 7:58 p.m.

It is possible that the missing right-angled triangle has vertices , and . The area of this triangle is , which is minimal.

• commented on Feb. 20, 2017, 4:09 p.m.

So it's guaranteed that the missing area is a non-degenerate, right angled triangle?

• commented on Feb. 20, 2017, 4:09 p.m.

So it's guaranteed that the missing area is a non-degenerate, right angled triangle?

• commented on Feb. 20, 2017, 5:18 p.m.

Since coordinates are at least 1, yes.

• commented on Feb. 20, 2017, 1:05 p.m.

Am I the only idiot who stuck at the third case first one???