This is just a quick message to let everyone know that the MATLAB
Contest Masters have been hard at work! They have been crafting a
really exciting new challenge for our Spring event with some very
cool prizes waiting for our champions.
It's time to clear your calendars so that you can come join the fun!
The contest will start at noon Eastern time on May 9, ending at noon
on Mary 16th.
We will be announcing more details about the contest as we get
closer, so if you want a refresher about MATLAB Central contests,
check out the contest overview page at <http://www.mathworks.com/contest/overview.html>.
ou can checkout past contests using links on that page.
Stay tuned for more information...
Best wishes,
Helen Chen
MATLAB Central Team
<http://blogs.mathworks.com/contest/>
We have a few channels for contest conversation. This newsgroup
thread is the best place for general discussion. If you have a
response to anything we post on the blog, we encourage you to leave a
comment on the blog itself. Finally, if you'd like to communicate
with the contest team privately, e-mail us at con...@mathworks.com.
Good luck to everyone!
Maybe this is in the code package, which I haven't looked at yet, but
what is the formula for the final result? In the past you've always
outlined it as something like
result = a*score + b*e^(c*time)
However with the new cyclomatic complexity variable it'd be helpful
to understand how that factors into the result.
I tried to run the solitaireGUI.m function which came with zipped
contest files, and got an error message as follows:
Warning: Divide by zero.
> In solitaireGUI at 63
??? Undefined command/function 'bsxfun'.
Error in ==> solitaireGUI>drawGUI at 200
c = c(:,~(sum(bsxfun(mf,1:size(c,2),(1:size(c,2))'))>1))';
Error in ==> solitaireGUI at 69
[hf,ha,sh,ht,hl] = drawGUI; printStats
I'm running MATLAB 7.1 student edition.
John
I added the scoring formula to the rules. It is the same as it was
before with k*complexity added on the end.
Thanks,
Matthew
>> runcontest
??? Too many inputs.
Error in ==> runcontest at 18
solutions = cellfun(@solver,boards,'UniformOutput',false);
>> runcontest(true)
??? Function name must be a string.
Error in ==> solitaireGUI>drawGUI at 184
ht = cellfun(@(f,p) uicontrol('Sty','Tex','Fore',f,'Back',[1 1
.83],...
Error in ==> solitaireGUI at 69
[hf,ha,sh,ht,hl] = drawGUI; printStats
Error in ==> runcontest at 27
solitaireGUI(testsuite(i).board,solution,min(1,5/size(solution,1)))
>>
(MATLAB version 7.0.1)
Any ideas?
Lucio
I am having the same problem with the bsxfun error message, as I am
running R2006a. The contest team did a good job in obfuscation, or
what do you think about these lines?
% mf = @(g,h) arrayfun(@(h)
all(inpolygon(c{1,g},c{2,g},c{1,h},c{2,h})),h);
% c = c(:,~(sum(bsxfun(mf,1:size(c,2),(1:size(c,2))'))>1))';
This source couldn't be easier to read I guess :-)
A good contest to all of you!
Markus
It's not deliberate obscufation that I can tell. The first line is
setting up an nested anonymous function handle (search for anonymous
functions in the MATLAB help for info). bsxfun is a new one to me,
but it applies element by element binary operations to 2 arrays.
The bottom line is they have used some of the more advanced
functionality to setup a demo solver and runcontest program that is
vectorized versus containing a lot of loops. This also factors into
the new Complexity rating.
Kudos to them for setting the bar high on this contest by trying to
start us off on a vectorized path instead of the 'easier to follow'
looping path many people would prefer to take.
% c = c(:,~(sum(bsxfun(mf,1:size(c,2),(1:size(c,2))'))>1))';
CHANGE TO:
MF = zeros(size(c,2));
for i1 = 1:size(c,2)
for i2 = 1:size(c,2)
MF(i1,i2) = mf(i1,i2);
end
end
c = c(:,~sum(MF)>1)';
% patch(bsxfun(@plus,j(:)',.1*sin(-2*pi:pi/4:2*pi)'),...
% bsxfun(@plus,i(:)',.1*cos(-2*pi:pi/4:2*pi)'),...
% zeros(17,numel(i)),'faceC',[0 .5 0],'FaceL','none');
CHANGE TO:
patch(repmat(j(:)',17,1)+repmat(.1*sin(-2*pi:pi/4:2*pi)',1,numel(j)),.
..
repmat(i(:)',17,1)+repmat(.1*cos(-2*pi:pi/4:2*pi)',1,numel(i)),...
zeros(17,numel(i)),'faceC',[0 .5 0],'FaceL','none');
Lucio
There is an error in the grade function, but I haven't been able to
figure it out yet.
Try to run the examples in the rules like this:
grade([7 0 2 0; 0 0 8 0; 0 7 0 0; 0 0 3 4], [1,3,3,3])
result = 31
according to the rules it should be 25
likewise
grade([7 0 2 0; 0 0 8 0; 0 7 0 0; 0 0 3
4],[4,4,4,2;4,2,2,2;2,2,2,4]);
result = 35
according to the rules it should be 17
I only discovered this because as I was testing things that should
work out, my score was going up, not down.
I have the same question. This seems odd:
board = [1 5 0];
score = grade(board,[1 1 1 3])
gives 7 (because the jump is invalid)
but
score = grade(board,[1 1 3 1])
gives 2; the expected score, i thought...
I have also big problems with the grade function.
Jan
moves = solver(board)
grade(moves)
moves = solver(board)
grade(moves(:,[2 1 4 3]))
Of course, runcontest does the former. So should we write our
solvers accordingly?
moves = moves(:,[2 1 4 3]);
> It looks like doing this at the end of your 'solver' solves the
> problem:
>
> moves = moves(:,[2 1 4 3]);
Yes but it's not supposed to work like that and confusing shifting
from row,colum indices to colum,row
Maybe I should stop solving and start evaluating again :-)
f = moves(i,[1 2]);
t = moves(i,[3 4]);
to
f = moves(i,[2 1]);
t = moves(i,[4 3]);
should be enough, albeit I will carefully revise it, when done we'll
update the zip file. Sorry for the inconvenience.
Lucio
f = moves(i,[2 1]);
t = moves(i,[4 3]);
then there will be consistency between grade.m and solitaireGUI.m
According to the web page, there is a 180 second time limit on our
programs. Is that for each board? How many boards will the programs be
expected to solve in 180 seconds?
-pete
As usual, the testsuite sample that we provide has the
same level of complexity as the hidden testsuite. 180 seconds is the
time given to solve the whole testsuite.
Lucio
I assume this error exists on the actual contest machine too. Are
you going to re-run all the entries submitted so far to get correct
scores?
This same code was used on the scoring machine. We've updated
grade.m there as well. One of the reasons that we the administrators
like starting the contest in darkness is that we can patch up any
last-minute discoveries before it affects the game.
Lucio dreams in MATLAB code, so please forgive its terseness. He was
also a contest participant before he was an employee. Have y'all
checked out our list of job openings? We're hiring!
Thanks everyone for your patience.
Great, for all those (like me) that are on much older versions
without anonymous functions (the @), they are easy to replace by
ordinary functions. NB, does the complexity of an anonymous functions
add to the cyclomatic complexity of the function they are defined in?
Also I was suprised that the peg values are not integers but all
kinds of floats? Is that correct?
Otherwise a fun puzzle indeed!
Damn...
I've been double checking my code for the last two hours.
Couldn't figure out why on earth every change I make keeps on
increasing my score.
Thanks for pointing out the fix guys.
>> board = [1 5 0];
>> moves = [1 1 1 3];
>> score = grade(board,moves)
score =
6
?
I thought score should be 2...
On May 10, 1:29 am, "Matthew Simoneau" <matt...@mathworks.com> wrote:
> Our contest will indeed begin today at noon EDT. I posted a welcome
> message to the contest blog with some new information:
Richard, there's no problem with try/catch, but you're not allowed to
call ERROR explicitly.
I'm using MATLAB Version 7.3.0.267 (R2006b).
Still getting error in GUI :
Undefined function or method 'bsxfun' for input arguments of type
'function_handle'.
How can I use the new GUI: solitaireGUIb.m
Any help?
Rgds,
Abhi
Open runcontest.m and change line
solitaireGUI(testsuite(i).board,solution,min(1,5/size(solution,1)))
to
solitaireGUIb(testsuite(i).board,solution,min(1,5/size(solution,1)))
srach
Thnxx..that works...
Rgds,
Abhi
runcontest
??? Error: File: C:\contest\jumping\solver.m Line: 10 Column: 6
"identifier" expected, "(" found.
Error in ==> C:\contest\jumping\runcontest.m
On line 20 ==> solutions{i} = solver(testsuite(i).board);
which pertains to
s = @(i,j) sub2ind([m,n],i,j);
in solver.m
Does anyone know why this errors? Is this due to my old version of
matlab?
Thanks
Lucio wrote:
>
>
> This may also be due to the fact that we used 7.4.0 to create the
> GUI, we will provide a backwards compatible version soon. Please
> bare
> with us.
>
> Lucio
>
> Windy Miller wrote:
>>
>>
>> I'm just trying to run "runcontest", to see what the basic
>> unmodified
>> solver does to the testsuite. I have a choice of error
> messages...
>>
>>>> runcontest
>> ??? Too many inputs.
>>
>> Error in ==> runcontest at 18
>> solutions = cellfun(@solver,boards,'UniformOutput',false);
>>
>>>> runcontest(true)
>> ??? Function name must be a string.
>>
>> Error in ==> solitaireGUI>drawGUI at 184
>> ht = cellfun(@(f,p) uicontrol('Sty','Tex','Fore',f,'Back',[1 1
>> .83],...
>>
>> Error in ==> solitaireGUI at 69
>> [hf,ha,sh,ht,hl] = drawGUI; printStats
>>
>> Error in ==> runcontest at 27
>>
>>
> solitaireGUI(testsuite(i).board,solution,min(1,5/size(solution,1)))
>>
>>>>
>>
>> (MATLAB version 7.0.1)
>>
>> Any ideas?
>runcontest
>??? Error: File: C:\contest\jumping\solver.m Line: 10 Column: 6
>"identifier" expected, "(" found.
>Error in ==> C:\contest\jumping\runcontest.m
>On line 20 ==> solutions{i} = solver(testsuite(i).board);
>which pertains to
>s = @(i,j) sub2ind([m,n],i,j);
>in solver.m
>Does anyone know why this errors? Is this due to my old version of
>matlab?
Did R12.1 support anonymous functions?
--
"It is important to remember that when it comes to law, computers
never make copies, only human beings make copies. Computers are given
commands, not permission. Only people can be given permission."
-- Brad Templeton
No. Anonymous functions were introduced in MATLAB 7.0 (R14). Brian, you
could try converting the anonymous functions into a regular function, but
you'd also need to modify the locations where those anonymous functions are
called to pass in the correct parameters in the correct order.
--
Steve Lord
sl...@mathworks.com
with the statement s=@(i,j) sub2ind([m,n],i,j);
am i just declaring a function S that takes in values i and j and is
simply using the sub2ind function?
when i call the s function in the above case as s(i,j) the value
returned in place of s(i,j) is just the value of sub2ind([m,n],i,j)?
Aside from having multiple script files what is the benefit in this
situation of using the anonymous function?
Thanks,
Brian
yes, that's right and all, just a more compact code...
to Walter: just replace s(x,y) in the code by sub2ind([m,n],x,y)
where x and y are the actual arguments used whereever you encounter
s. In grade.m you need to do something similar to t(f)
b
The rest of this message is "The function ERROR has been disabled".
ERROR is on our list of blocked functions.
While we are at it, it turns out that ERROR appeared in the function
grade which you supplied and I used. Maybe you want to consider
removing it from grade... :)
Thanks again!
Does anyone know what the number in paranthesis just below the
Results field is? Does it have anything to do with the submissions
cyclomatic complexity?
Cyclistmatic?
I added "cyc: " in front of the number so everyone will have a chance
of guessing what it means. Someday we'll get this thing its own
column.
As I put in my comment:
Note in the interest of collaboration I'm documenting the leading
code as much as possible. Instead of going the obscufation route with
this, I invite everyone to document / take credit for their
particular changes as the codes get modified. At a minimum, please
don't remove the existing comments so someone doesn't have to start
from scratch on commenting updated code again
I did put in a small algorithmic tweak to make it a bit faster, which
puts it into 1st place as of 2:30AM, but I definitely can't take
credit for the bulk of the effort, which was developed back and forth
between several other contestants over the course of the day.
I hope this gesture prevents or at least delays the onset of
obscufation that normally happens about now in the contest. Such
obscufation makes it more challenging for new competitors to jump in
and understand what's going on.
Great idea Alan! That is really in the spirit of the contest!
In the last contests we were already crying for inserting a "captcha"
on the entry submit page. Just as I have to fill "BTQNT" in a Word
verfication line below the form where I currently am typing this text
in. This would prevent spamming the queue and searching for the best
parameters by multiple entries.
Did you not include it because you don't like the idea or because you
did not have the resources to do the modification to the interface?
Markus
We definitely think think that this is a good idea but unfortunately
do not have the resources to redo the contest site at this time. We
are looking to do something along those lines in the future.
Helen
Looks like there might be some small problems with the statistics
page. The Saturday "Contributions in Daylight" seem to be being
counted in Friday as well. Also, I think some or all of the graphs
on that page are not being updated.
Thanks again for putting on the contest.
Helen
%%%%% function tb
function p = tb(p,siz)
all([p>0 p<=[siz(2) siz(1)] ~rem(p,1)]);
Is this correct?
Also I received errors on all if statements which use || or && and
that was solved by changing them to | and & respectively.
Have these operators changed in recent versions ?
After this on runcontest I am getting
ans =
results: 130055.0797
time: 0.59
Is this what i am supposed to get?
Note: I started a new thread on the MATLAB Newsgroup page that you
can reply to this. I only posted this message so that some of the
contestants would see and reply.
Continuing to be the watchdog of the Stats page ...
I think the Most Active Participants graph is not being updated.
Unfortunately, with the number of subfunctions and recursive calls
the code has become much more difficult to understand than in my
previous attempt at this. Hopefully you'll find this of value /
interest.
As you have read, I won the Big Sunday Push. I just want to tell you
the interesting story how lucky I were to win this prize.
My contribution markus9 introduced a significant speed improvement to
the part of the code origininating from Yi Cao and his twilight
winning contribution. Actually I had already put this improvement in
an earlier submission called markus8 of 2007-05-12 07:58:42. If I had
not made an algorithmic error when combining some different code
versions, I had probably won the Saturday Early Morning Special (at
2007-05-12 08:00:00) with this contribution.
Well, as markus8 finished somewhere in no man's land, of course no
one took notice of the improvement. So I had the chance to use it in
another attempt. markus9 - now without this f... error - made an
improvement about 8 points. However, looking into the statistics
later that day, I was disappointed that Jan Langer had already
reached a cumulative improvement of more than 10 by numerous tweaking
contributions (when does this guy sleep?!?).
But, to my great surprise, my speed improvement disappeared from the
leading code again over the day! It was Nathan Q who found another,
even larger way to improve the speed. He took the lead with his
submission bigh_L8 at 06:12 h after my submisson markus9 of 05:17 h
(no, I don't work all through the night, I just live in another time
zone). As the other contestants now started working on the code of
the new leader, it happened that I had a third chance to use the same
improvement again. This time the impact was even larger (about 18
points), lifting me up to win the Big Sunday Push.
I'd like to mention the contribution of Nathan Q here again, who
introduced a fast update to the vector of possible moves instead of
completely recomputing it. I guess in the next contests, I may not
hope that Nathan gives me such assistance again in winning a
midcontest prize. :-)
I wish you lots of fun during the remaining time of this contest!
Markus
After telling such a long story, I want to make another suggestion
for a small rule change. I think in the 1000 character challenge, all
variable names should be counted as one character, as well as all
subsequent whitespaces. This way no one would need to obfuscate code
by replacing all meaningful variable names to one-character variable
names and to remove all linebreaks and indentation. I think a script
counting this way can be written as fast as a
character-saving-by-obfuscation one.
What do you think?!?
Markus
Isn't the maximum time allowed 180 seconds? How come I'm yet to see
an entry that takes more than 60 seconds?
Thanks people...
Shashi
I think the introduction of nested functions to Matlab led to even
more unreadable code. They might be nice to have for a short
three-liner in another function. But excessively used like in the
current contest, they lead to perfect disorientation and mistakes.
You will have to be extremely attentive not to use a variable like i
or m or n that is also used in the parent function, if there are many
nested functions over a large number of lines.
Is this problem related to my internet connection or is the site
down, i.e., does anybody experience the same problem?
Best,
srach
k1 = 0.1
k2 = 2
k3 = 0.05
k4 = 1
SY
Bad timing for "planned server maintenance". I hope Brian Welch
wasn't behind this!
Another dumb question, the contest is open till Wednesday 12PM EDT,
right?
My entry 'Lions' : ID - 41452 - 2007-05-15 14:26:18 - Score -
3947.6295
and
nathan q's entry 'Filigree Siberian Hamster 2': ID - 41457 -
2007-05-15 14:29:33 - Score - 3947.3199
Performing a diff on these produced no differences, then examining
submission time shows that nathans was submitted after mine.
Is is it explained anywhere the effect of a high number of entries
waiting in the queue and the actual score. I assumed that each file
was tested in the same environment?
Thanks!
PS. This contest is addictive
Since the contest is drawing to a close, this presents an opportunity
to start making suggestions for improvements. Its been suggested
many times in the past, but I'll again suggest that the number 1
improvement would be to put a roundoff in the time contribution to
overall score. I think rounding off to the nearest tenth or quarter
of a second would still entice people to try to tweak parameters ,
but would eliminate the variability due to system variations.
On both occasions during this contest when I submitted a heavily
commented version of the leading code, my commented version took the
lead for quite a while. I made no algorithmic changes to the code,
yet due to the fact I submitted them when the queue's were empty and
machine basically idle I got a slight speedup in the run-time. While
that was a nice quirk, it clearly illustrates the variability queue
load has on the timing calculations.
Anybody have any other suggestions for way to improve the contest?
Hi Mike:
The cyclist is right to say that, try as hard as we might (and we do
try) identical files get different running times.
I carefully diff'd the two files you describe, and you're right, they
are identical. If this were a matter of winning the contest (or
winning one of our mini-contest challenges), we would award the prize
to the person who first submitted the code that did the best. In this
case, you would get the prize. But since there's no prize at stake,
we just let stuff like this ride.
As the contest nears its end, people are often working near the
"noise floor" of our measuring capability. They are making tiny
improvements that could easily be negated by a passing cosmic ray. We
like to think that this is part of the charm of the contest. In any
event, we ask that people not intentionally resubmit identical code.
It won't help you win a prize.
-Ned.
For the record, these two entries were developed independently. In
fact, according to the "based on" credits, both came from BirdBrain's
Bill Murray's Explosive Gerbil, which was the leader at the time. I
was just fiddling with the obvious parameters - it's not surprising
that two of us would come up with identical tweaks. It's right that
the earlier submission should get the credit if a prize is at stake.
Nathan
PS thanks, Mathworkers, for another great contest.
To the contrary, I think this was a brilliant move on their part. By
effectively 'shutting down the feedback loop' they've dropped us into
a 'dusk' like state. Unlike twilight where we can see all the scores
but not the code, here we can see the code but not the scores.
Something like this has been suggested several times in the past as a
way to reduce the effect of last minute tweaking on the final grand
prize winner and put more focus on algorithm development.
I personally hope the queue gets filled up even more overnight such
that tomorrow morning we are in a similar situation.
Limiting the number of submissions for each contestant, for example,
per hour or per day, would also be nice, but as we only put a nick
and an E-mail address, it will be hard to realize such rule.
Markus
Sergey
- Round cpu time to 0.1 sec to avoid timing inconsistencies.
- Add column for cyclomatic complexity.
- Show statistics page earlier in the contest.
- Add a reasonably accurate timestamp of The Mathwork's official time
to the top of the submit page. It doesn't have to be perfect, but it
would help with last minute entries.
- For the 1000 character challenge, don't count whitespace
(whitespace = spaces, tabs, and newlines). That way, entries can have
commands on different lines and keep proper indentation. I included a
simple script below that can do the counting.
All that said, it has been another great contest. Thanks Mathworks
team! Also thanks to all the contestants for the well-commented code
and following the 'no welching' rule.
Steve
------------------------------------------------
function c = charcountnowhitespace(fn)
% Count the characters in a file, excluding whitespace (spaces, tabs,
and
% newlines). Returns the character count, or -1 if file error.
%
% Example call: c = charcountnowhitespace('charcountnowhitespace.m')
% Steve Hoelzer 2007-05-16
fid = fopen(fn);
if fid == -1
c = -1; % error opening file
return
end
% Count chars
c = 0;
line = fgetl(fid);
while isempty(line) || line(1) ~= -1
line(line == 32) = []; % remove spaces
line(line == 9) = []; % remove tabs
line(line == 10) = []; % remove newlines
c = c + length(line);
line = fgetl(fid);
end
if fclose(fid)
c = -1; % error closing file
end
So, it's all over but the crying. Thanks to the team for an
exceptionally smooth contest. I was really happy that obfuscation
didn't really enter, and that folks adhered to the request for no
Welching. The most infuriating part of the last couple contests was
when the queue broke down completely, so it was nice that that did
not happen this time around.
Good luck to all entries still in the queue. I estimate that it will
be done processing by around 15:00 EDT, all the entries run in about
the same CPU time as the current leader.
the cyclist (aka "tev")
I concur, this contest has been blast! The Matlab team deserves
thanks for keeping this running without any hitches!
Now we get to eagerly await the final outcome, I have a strong
feeling that "tev" will overtake me. It will be interesting if
another approach bests the current leader.
My effective entry popped a little to early,~10mins, so the masses
have consumed :)
sidenote: Ken Eaton you sure do know how to make this suspenseful.
- MikeR
> It will be interesting if
> another approach bests the current leader.
I am curious what improvements are in the queue. Obviously, there is
some pure parameter tweaking, and that is always a threat.
I personally have two separate time improvements. They are small but
"real", and should both get over the timing variability, I think.
1) I replaced "sum(board(:)>0)" with "nnz(board)".
2) I defined iii=[i;i], and did a wholesale replacement of "i;i" with
"iii", along with a couple related efficiencies. Ditto with jjj.
I had a third replacement that I thought would be an improvement,
which was to define a variable "peg=board(:)>0", which identified
where pegs were. This could be used later in the calculation of the
count of pegs, and a couple of other ways. However, it seems this
did not really improve the time.
We are a bit baffled by how the following code could possibly come to
exist without some probing of the contest suite going on. Yet many
appear to be using it??
fc=((pegCount < 250)||...
(pegCount==272)||...
(pegCount==516)||...
(pegCount==544)||...
(pegCount==535)||...
(pegCount==540)||...
(pegCount==542)||...
(pegCount==542)||...
To be clear, we are not accusing anyone of anything. just asking...?
Thanks to the Mathworks contest team for one of he best contests yet.
Regards
Hannes & Cobus
a.k.a. Jacob & matlabboy
P.S. Yes we now our aliases and submission titles are stupid but you
do what you can to avoid being picked up by cyc's improvement radar.
Allthough it looks like this time it was Yi that caught us.
At the end I was trying to introduce three minor algorithm
modifications:
1. Make “random loop” run longer for board with higher mean weight
2. Combine subsol and solveri (run solveri inside subsol when there
are few pegs left) . Too much time penalty here, probably.
3. Count pegs on “black fields and white fields” (imagine that board
is colored as chess board, black pegs always stay black and always
remove white and vise versa) and introduce additional weight
parameter depending on ratio of sizes of two peg groups.
Best wishes to everybody,
Sergey
Is that in reference to my frantic last-minute submissions of what
will likely be unsuccessful attempts?
First I'd like to say thanks to all the MathWorks staff. Although I
am a long time MATLAB user, this was only the first contest I
submitted anything for (I tried for the Black Box, but never finished
anything in time to submit). Unfortunately, for this contest I didn't
have enough time to really dig in and see what other algorithms were
being tried by others. Still had fun though!
Most of my attempts centered around the idea of "black" and "white"
squares competing with one another (mentioned by a few people on
here), hence why I prefaced all my submissions with "predator/prey".
We'll see how my newest ones do (probably not as good as the top
contenders).
How did you send over 15 tweaks of entries in the queue in less than
2 minutes? That is 1 every 8 seconds! You must have been pedaling
really fast...
Joseph
Hannes & Cobus,
Thanks let us know your aliases. I pick up entries submitted by
matboy by chance. This morning, when I opened an IE window to look
the queue, I found a suspicious entry in the queue by matlabboy
without a valid email address. By searching matlabboy I found three
entries. All codes have a return with moves = [0 0 0 0] at the end.
Clearly, these entries is to test some improvement on solveri code.
Therefore, I copied one of these codes into my codes for the final
submission. For the above codes, I found from Jin's entry Iamcrazy31,
I belieave this is a prob series.
I wish to think to Mathwork team to organize this contest. This is a
very interesting problem. One can easily get an idea to improve the
algorithm. However, the time penalty makes many of them. This
morning, I just got an idea to improve the speed. After an hour's
work, finally I made it works. To make this code more valuable, I
waited until almost last minutes to scan the queue to try to catch
some new code to combine with this improvement. Wish myself good
luck.
Yi Cao