MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

This Challenge is to solve Question C, Martian Pranks, of the USC ACM Fall 2012 Contest.

Rocks are moving between Rover pictures. This proves Life on Mars, but how Fast is that Life?

All Rocks are bounded by a square with opposite corners (0,0) and (1,1). The camera only sees this 1x1 area. One Martian per Rock. Martians travel the minimum distance from the 1x1 edge to the initial rock position and from the final rock position to the edge to hide at velocity V. While moving a rock Marty's velocity reduces to V/2. An unmoved rock allows Marty to stay on the sideline. Note, the camera software does not track specific rocks, so an unmoved rock in Pict1 may be item 1 and this same rock may be item 4 in the second picture. Multiple rocks may occupy the same location in a picture.

Return the Minimum Martian Speed to transition from the initial Rock set to the Final rock set.

**Input: [Rock_locations_Pict1_Pict2,Time between pictures ]**

**Output: [Minimum Martian Speed]**; to 2 decimal places;

**Scoring: Cumulative Time ( msec )**

The full USC data file

**Example:**

**Input: [0.3 0.6;0.4 0.5;0.5 0.5;0.95 0.2;0.6 0.5;0.9 0.4;0.5 0.5; 0.3 0.6], 3.0**

Essentially, 4 rocks in two pictures with a time between pictures of 3 seconds

**Output: 0.37** is quite obvious, not in the least

This answer comes by moving [I1 F4; I2 F3; I3 F1; I4 F2] with rows two and three being of equal maximum effective distance of 1.1. My "effective distance" for I2 F3 is .4 + (.1)*2 + .5, where .1 is hypot(I2,F3) and multiply by 2 for speed reduction. This 1.1/3 rounds to 0.37.

The Winner's Pranks solution. This solution is much tighter than my first method thus I am scoring by time. Hopefully someone can champion Matlab and produce a succinct and worthy solution. The winner solved this in 22 minutes and second place took a leisurely 65 minutes. Time Started when the page was opened.

7 correct solutions
1 incorrect solutions

Last solution submitted on Sep 21, 2013

3 players like this problem

1 player likes this solution

1 Comment

Richard Zapor
on 11 Dec 2012

Very fast and very compact solution. Nice usage of complex to calculate distance between points and recursion.

1 Comment