SRM 641, D1, 250-Pointer (TrianglesContainOrigin)

James S. Plank

Wed Sep 4 13:40:55 EDT 2019
My writeup of this problem is in presentation form. You can find it here: http://web.eecs.utk.edu/~jplank/plank/classes/cs494/494/notes/TrianglesContainOrigin/.

In case Topcoder's servers are down

Here is a summary of the problem:

Examples

These are all included in main.cpp. If you give the input "-" to main.cpp, then it will read its values from standard input.

Example x y Answer
0 {-1,-1,1} {1,-1,0} 1
1 {-1,-1,1,2} {1,-1,2,-1} 2
2 {-1,-2,3,3,2,1} {-2,-1,1,2,3,3} 8
3 {1,5,10,5,-5,7,-9,-6,-3,0,8,8,1,-4,7,-3,10,9,-6} {5,-6,-3,4,-2,-8,-7,2,7,4,2,0,-4,-8,7,5,-5,-2,-9} 256

The program genpoints.cpp will also generate random input for you, when you call a.out -.

Testing Yourself


Solution

I have three solutions: I also have:
time-it.sh       -- a shell script to time the three solutions
timing-graph.jgr -- jgraph of the timings
timing-graph.jpg -- jgraph of the timings, converted to JPG
timing-graph.pdf -- jgraph of the timings, converted to PDF
timings.txt      -- the output of time-it.sh