{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2025-12-14T01:33:56.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2025-12-14T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":677,"title":"Vine Contest 1-D Case Optimization: Board 78","description":"The Vine contest was to slide tiles around and then identify a vine of increasing values that are four point connected with no repeats. See the \u003chttp://www.mathworks.com/matlabcentral/contest/contests/34 Vine contest\u003e for full details.\r\n\r\nThis challenge is specifically for the linear [1 n] case.\r\n\r\nThis did not exist in the competition suite but did in the test suite as brd 78. The 1-D case was not optimized during the contest.\r\n\r\nInput  b = [1 5 2 3 1 2 8] ..limit 2\r\n\r\nOutput: v=[3 4 5] and moves =[7 6;6 5] making [1 5 2 3 8 0 0]\r\n\r\nScore is 13.\r\n\r\nThe board may be flipped LR but will always be a row.\r\n\r\n..............................................Limit  10000....7250...6681....1000........0\r\n\r\nNieto-Castanon Winning Code:...5705...5705...5705....3114 2564\r\n\r\nOptimal Score values...................20244 20244 20167 13048 2564\r\n","description_html":"\u003cp\u003eThe Vine contest was to slide tiles around and then identify a vine of increasing values that are four point connected with no repeats. See the \u003ca href=\"http://www.mathworks.com/matlabcentral/contest/contests/34\"\u003eVine contest\u003c/a\u003e for full details.\u003c/p\u003e\u003cp\u003eThis challenge is specifically for the linear [1 n] case.\u003c/p\u003e\u003cp\u003eThis did not exist in the competition suite but did in the test suite as brd 78. The 1-D case was not optimized during the contest.\u003c/p\u003e\u003cp\u003eInput  b = [1 5 2 3 1 2 8] ..limit 2\u003c/p\u003e\u003cp\u003eOutput: v=[3 4 5] and moves =[7 6;6 5] making [1 5 2 3 8 0 0]\u003c/p\u003e\u003cp\u003eScore is 13.\u003c/p\u003e\u003cp\u003eThe board may be flipped LR but will always be a row.\u003c/p\u003e\u003cp\u003e..............................................Limit  10000....7250...6681....1000........0\u003c/p\u003e\u003cp\u003eNieto-Castanon Winning Code:...5705...5705...5705....3114 2564\u003c/p\u003e\u003cp\u003eOptimal Score values...................20244 20244 20167 13048 2564\u003c/p\u003e","function_template":"function [m v] = solver_1D_vine(b,limit)\r\n  v=[];\r\n  m=[];\r\nend","test_suite":"%%\r\nglobal boardz\r\nboardz=[298   513    77   456   114   461   638   280   126   345   526   481   533   650   417   499   508   589   262   452   147   336   303   582   129   498   714   296   370   524   253 151   586   581    42    93   472    90   486   630   235   377   721    66   251   577   598   189   688   211   436   709   715   120   613    33   517   274   293    34   102   265 378   490   585    49   553   266   263   583   446   617   426   512   286   314   388   705   181   557   267   656   340   668   246   507   675   403   689    70   636   627   334 305   110   578    63   445   227    83   634   518   692   425   322   604    19   365    26   292   698   612   470   489   275    20   339   546   431   186     4   633   260   397 121   109   665   430   399    94   563   316   252   182   550   233   544   621    11   382   646   473    97   597    74    30   134   429   250   395   331   337   640     3   500 175   242   538   308   554   157   217   416   722    39   204   632    57   128   216   516     2   306   700   455   601   539   206   644   376   173   142   434   289   284   335 62   690   158   318   228   565   574   155   268   561   381   178   192   199   710   641   241     8   338   537   138   521   396    48   408   676   530    73   520   362   344 130    98   356   575   648   135   295   330   270    35   469   454   346   361   666   652   422   194   708   527   504   639   606   542   441   124   384   243   188   448   348 156   610   484   210   514   528   256   287   693   685   351   523   699   373   404   620   667   442    13   510   447   411    92   540   616   247   466    76   197   672   200 494   724   566   393    51   413   637   618   271   625   681   567   629   658   282   488   187   570    53   385   324   244   367    87   428   190   482   406   584    91   112 590    18   326   535    64   191   166   141   522   635   663   307    81    46   541   664    96    37   716   624   720   475   536   357   459   160    58   193   707   683   568 229   122   678   684   573    40   221   694    23   579   529   255   226    72   176   711   127   435   355   647   288   595   562   198   511   712    67   509   421   240   161 717   150   556   559    99   105   386   451   480   342   332   390   167   146   552   113   254   291   209   444   364   487   169   313   602   719   696   152   655   569   493 379   460   207   476   614   165   439   592   483   360    32   680    69     6   171   580   264   220   458   660   695   474   230   560   409   725   669   615   343   212   449 205   608   325   350   143   231    24   352   649   654   457   144   414   427   371   159    55   172   463   587   116    95   368   673   168     5    60   686   443   148   525 279   145   164   179   301   347    65   723    29   153   392   162   224   123    84   103   136   320    68    71    85   358   174   359   548    52   423   300   438   281   485 259    43   304    59   551   418   319   420   315   353   218   405   505   607   258   374   619   329   290   132   400   491   402   101    12   687   412   545   234    44   201 196   225   389   203   479   671   503    15   657   495   222   653     7   465   437   631    61    45     1   104    21   453   703   139   549   407   467   576   626   391   623 366   497   133    27   341   299   534   180   257   236   440   177   215   163   272    28   131   363   659    79    14   321   249   506   154   108   642   208   713   117   183 31    47   609   718   185   273   674   383   137   670   682   354   594   238   471    38    22    10    89   278   477   704   501   645   593   492   419    80   588   564   372 17   410   596   118   432    88   311   600   328   401   297    56   450   312   697   622   302   424   170   555   232   237   125   558   223   661   327   219   380    50   651 261   628   605   184   100   701    75   662   276    78   195   603   398   433   115   572   519   323    25   239   269   283   149   285   214    41   349   691   309   591    36 462   677   599   468   387   317    16   107    86   248   478   213   571   543   464    82   245   310   277   415   375   515   119   532   702   496   611   531   643   294   369 547   394   333   202     9   111   706   679    54   502   106   140];\r\n\r\n\r\nboard=fliplr(boardz);\r\nlimit=7250;\r\n[moves vine] = solver_1D_vine(board,limit);\r\nresult_expected=20244;\r\n    \r\n    Pass=1;\r\n    btemp=board;\r\n    for m=1:length(moves)\r\n     btemp(moves(m,2))=btemp(moves(m,1));\r\n     btemp(moves(m,1))=0; \r\n    end\r\n    bvec=btemp(vine); % expected to be increasing\r\n    dmin=min(bvec(2:end)-bvec(1:end-1));\r\n    result=sum(btemp(vine))\r\n\r\n    if dmin\u003c0\r\n     fprintf('Not Pass: Non-increasing seq\\n')\r\n     Pass=0;\r\n    end\r\n    if length(moves)\u003elimit\r\n     fprintf('Not Pass: %i moves used: Limit %i\\n',length(moves),limit)\r\n     Pass=0;\r\n    end\r\n    if result\u003c0.9*result_expected\r\n     fprintf('Not Pass: Score %i  Less than expected  %i\\n',result, 0.9*result_expected)\r\n     Pass=0;\r\n    end\r\n    \r\nassert(isequal(Pass,1))\r\n%%\r\nglobal boardz\r\nboard=boardz;\r\nlimit=7250;\r\n[moves vine] = solver_1D_vine(board,limit);\r\nresult_expected=20244;\r\n    \r\n    Pass=1;\r\n    btemp=board;\r\n    for m=1:length(moves)\r\n     btemp(moves(m,2))=btemp(moves(m,1));\r\n     btemp(moves(m,1))=0; \r\n    end\r\n    bvec=btemp(vine); % expected to be increasing\r\n    dmin=min(bvec(2:end)-bvec(1:end-1));\r\n    result=sum(btemp(vine))\r\n\r\n    if dmin\u003c0\r\n     fprintf('Not Pass: Non-increasing seq\\n')\r\n     Pass=0;\r\n    end\r\n    if length(moves)\u003elimit\r\n     fprintf('Not Pass: %i moves used: Limit %i\\n',length(moves),limit)\r\n     Pass=0;\r\n    end\r\n    if result\u003c0.9*result_expected\r\n     fprintf('Not Pass: Score %i  Less than expected  %i\\n',result, 0.9*result_expected)\r\n     Pass=0;\r\n    end\r\n    \r\nassert(isequal(Pass,1))\r\n%%\r\nglobal boardz\r\nboard=boardz;\r\nlimit=6681;\r\n[moves vine] = solver_1D_vine(board,limit);\r\nresult_expected=20167;\r\n    \r\n    Pass=1;\r\n    btemp=board;\r\n    for m=1:length(moves)\r\n     btemp(moves(m,2))=btemp(moves(m,1));\r\n     btemp(moves(m,1))=0; \r\n    end\r\n    bvec=btemp(vine); % expected to be increasing\r\n    dmin=min(bvec(2:end)-bvec(1:end-1));\r\n    result=sum(btemp(vine))\r\n\r\n    if dmin\u003c0\r\n     fprintf('Not Pass: Non-increasing seq\\n')\r\n     Pass=0;\r\n    end\r\n    if length(moves)\u003elimit\r\n     fprintf('Not Pass: %i moves used: Limit %i\\n',length(moves),limit)\r\n     Pass=0;\r\n    end\r\n    if result\u003c0.9*result_expected\r\n     fprintf('Not Pass: Score %i  Less than expected  %i\\n',result, 0.9*result_expected)\r\n     Pass=0;\r\n    end\r\n    \r\nassert(isequal(Pass,1))\r\n%%\r\nglobal boardz\r\nboard=boardz;\r\nlimit=1000;\r\n[moves vine] = solver_1D_vine(board,limit);\r\nresult_expected=13048;\r\n    \r\n    Pass=1;\r\n    btemp=board;\r\n    for m=1:length(moves)\r\n     btemp(moves(m,2))=btemp(moves(m,1));\r\n     btemp(moves(m,1))=0; \r\n    end\r\n    bvec=btemp(vine); % expected to be increasing\r\n    dmin=min(bvec(2:end)-bvec(1:end-1));\r\n    result=sum(btemp(vine))\r\n\r\n    if dmin\u003c0\r\n     fprintf('Not Pass: Non-increasing seq\\n')\r\n     Pass=0;\r\n    end\r\n    if length(moves)\u003elimit\r\n     fprintf('Not Pass: %i moves used: Limit %i\\n',length(moves),limit)\r\n     Pass=0;\r\n    end\r\n    if result\u003c0.9*result_expected\r\n     fprintf('Not Pass: Score %i  Less than expected  %i\\n',result, 0.9*result_expected)\r\n     Pass=0;\r\n    end\r\n    \r\nassert(isequal(Pass,1))\r\n%%\r\nglobal boardz\r\nboard=fliplr(boardz);\r\nlimit=0;\r\n[moves vine] = solver_1D_vine(board,limit);\r\nresult_expected=2564;\r\n    \r\n    Pass=1;\r\n    btemp=board;\r\n    for m=1:length(moves)\r\n     btemp(moves(m,2))=btemp(moves(m,1));\r\n     btemp(moves(m,1))=0; \r\n    end\r\n    bvec=btemp(vine); % expected to be increasing\r\n    dmin=min(bvec(2:end)-bvec(1:end-1));\r\n    result=sum(btemp(vine))\r\n\r\n    if dmin\u003c0\r\n     fprintf('Not Pass: Non-increasing seq\\n')\r\n     Pass=0;\r\n    end\r\n    if length(moves)\u003elimit\r\n     fprintf('Not Pass: %i moves used: Limit %i\\n',length(moves),limit)\r\n     Pass=0;\r\n    end\r\n    if result\u003c0.9*result_expected\r\n     fprintf('Not Pass: Score %i  Less than expected  %i\\n',result, 0.9*result_expected)\r\n     Pass=0;\r\n    end\r\n    \r\nassert(isequal(Pass,1))\r\n%%\r\nglobal boardz\r\nboard=boardz;\r\nlimit=10000;\r\n[moves vine] = solver_1D_vine(board,limit);\r\nresult_expected=20244;\r\n    \r\n    Pass=1;\r\n    btemp=board;\r\n    for m=1:length(moves)\r\n     btemp(moves(m,2))=btemp(moves(m,1));\r\n     btemp(moves(m,1))=0; \r\n    end\r\n    bvec=btemp(vine); % expected to be increasing\r\n    dmin=min(bvec(2:end)-bvec(1:end-1));\r\n    result=sum(btemp(vine))\r\n\r\n    if dmin\u003c0\r\n     fprintf('Not Pass: Non-increasing seq\\n')\r\n     Pass=0;\r\n    end\r\n    if length(moves)\u003elimit\r\n     fprintf('Not Pass: %i moves used: Limit %i\\n',length(moves),limit)\r\n     Pass=0;\r\n    end\r\n    if result\u003c0.9*result_expected\r\n     fprintf('Not Pass: Score %i  Less than expected  %i\\n',result, 0.9*result_expected)\r\n     Pass=0;\r\n    end\r\n    \r\nassert(isequal(Pass,1))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-05-10T16:36:20.000Z","updated_at":"2012-05-17T18:46:31.000Z","published_at":"2012-05-16T23:50:10.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Vine contest was to slide tiles around and then identify a vine of increasing values that are four point connected with no repeats. See the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/contest/contests/34\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eVine contest\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e for full details.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis challenge is specifically for the linear [1 n] case.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis did not exist in the competition suite but did in the test suite as brd 78. The 1-D case was not optimized during the contest.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eInput b = [1 5 2 3 1 2 8] ..limit 2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOutput: v=[3 4 5] and moves =[7 6;6 5] making [1 5 2 3 8 0 0]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eScore is 13.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe board may be flipped LR but will always be a row.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e..............................................Limit 10000....7250...6681....1000........0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNieto-Castanon Winning Code:...5705...5705...5705....3114 2564\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOptimal Score values...................20244 20244 20167 13048 2564\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":677,"title":"Vine Contest 1-D Case Optimization: Board 78","description":"The Vine contest was to slide tiles around and then identify a vine of increasing values that are four point connected with no repeats. See the \u003chttp://www.mathworks.com/matlabcentral/contest/contests/34 Vine contest\u003e for full details.\r\n\r\nThis challenge is specifically for the linear [1 n] case.\r\n\r\nThis did not exist in the competition suite but did in the test suite as brd 78. The 1-D case was not optimized during the contest.\r\n\r\nInput  b = [1 5 2 3 1 2 8] ..limit 2\r\n\r\nOutput: v=[3 4 5] and moves =[7 6;6 5] making [1 5 2 3 8 0 0]\r\n\r\nScore is 13.\r\n\r\nThe board may be flipped LR but will always be a row.\r\n\r\n..............................................Limit  10000....7250...6681....1000........0\r\n\r\nNieto-Castanon Winning Code:...5705...5705...5705....3114 2564\r\n\r\nOptimal Score values...................20244 20244 20167 13048 2564\r\n","description_html":"\u003cp\u003eThe Vine contest was to slide tiles around and then identify a vine of increasing values that are four point connected with no repeats. See the \u003ca href=\"http://www.mathworks.com/matlabcentral/contest/contests/34\"\u003eVine contest\u003c/a\u003e for full details.\u003c/p\u003e\u003cp\u003eThis challenge is specifically for the linear [1 n] case.\u003c/p\u003e\u003cp\u003eThis did not exist in the competition suite but did in the test suite as brd 78. The 1-D case was not optimized during the contest.\u003c/p\u003e\u003cp\u003eInput  b = [1 5 2 3 1 2 8] ..limit 2\u003c/p\u003e\u003cp\u003eOutput: v=[3 4 5] and moves =[7 6;6 5] making [1 5 2 3 8 0 0]\u003c/p\u003e\u003cp\u003eScore is 13.\u003c/p\u003e\u003cp\u003eThe board may be flipped LR but will always be a row.\u003c/p\u003e\u003cp\u003e..............................................Limit  10000....7250...6681....1000........0\u003c/p\u003e\u003cp\u003eNieto-Castanon Winning Code:...5705...5705...5705....3114 2564\u003c/p\u003e\u003cp\u003eOptimal Score values...................20244 20244 20167 13048 2564\u003c/p\u003e","function_template":"function [m v] = solver_1D_vine(b,limit)\r\n  v=[];\r\n  m=[];\r\nend","test_suite":"%%\r\nglobal boardz\r\nboardz=[298   513    77   456   114   461   638   280   126   345   526   481   533   650   417   499   508   589   262   452   147   336   303   582   129   498   714   296   370   524   253 151   586   581    42    93   472    90   486   630   235   377   721    66   251   577   598   189   688   211   436   709   715   120   613    33   517   274   293    34   102   265 378   490   585    49   553   266   263   583   446   617   426   512   286   314   388   705   181   557   267   656   340   668   246   507   675   403   689    70   636   627   334 305   110   578    63   445   227    83   634   518   692   425   322   604    19   365    26   292   698   612   470   489   275    20   339   546   431   186     4   633   260   397 121   109   665   430   399    94   563   316   252   182   550   233   544   621    11   382   646   473    97   597    74    30   134   429   250   395   331   337   640     3   500 175   242   538   308   554   157   217   416   722    39   204   632    57   128   216   516     2   306   700   455   601   539   206   644   376   173   142   434   289   284   335 62   690   158   318   228   565   574   155   268   561   381   178   192   199   710   641   241     8   338   537   138   521   396    48   408   676   530    73   520   362   344 130    98   356   575   648   135   295   330   270    35   469   454   346   361   666   652   422   194   708   527   504   639   606   542   441   124   384   243   188   448   348 156   610   484   210   514   528   256   287   693   685   351   523   699   373   404   620   667   442    13   510   447   411    92   540   616   247   466    76   197   672   200 494   724   566   393    51   413   637   618   271   625   681   567   629   658   282   488   187   570    53   385   324   244   367    87   428   190   482   406   584    91   112 590    18   326   535    64   191   166   141   522   635   663   307    81    46   541   664    96    37   716   624   720   475   536   357   459   160    58   193   707   683   568 229   122   678   684   573    40   221   694    23   579   529   255   226    72   176   711   127   435   355   647   288   595   562   198   511   712    67   509   421   240   161 717   150   556   559    99   105   386   451   480   342   332   390   167   146   552   113   254   291   209   444   364   487   169   313   602   719   696   152   655   569   493 379   460   207   476   614   165   439   592   483   360    32   680    69     6   171   580   264   220   458   660   695   474   230   560   409   725   669   615   343   212   449 205   608   325   350   143   231    24   352   649   654   457   144   414   427   371   159    55   172   463   587   116    95   368   673   168     5    60   686   443   148   525 279   145   164   179   301   347    65   723    29   153   392   162   224   123    84   103   136   320    68    71    85   358   174   359   548    52   423   300   438   281   485 259    43   304    59   551   418   319   420   315   353   218   405   505   607   258   374   619   329   290   132   400   491   402   101    12   687   412   545   234    44   201 196   225   389   203   479   671   503    15   657   495   222   653     7   465   437   631    61    45     1   104    21   453   703   139   549   407   467   576   626   391   623 366   497   133    27   341   299   534   180   257   236   440   177   215   163   272    28   131   363   659    79    14   321   249   506   154   108   642   208   713   117   183 31    47   609   718   185   273   674   383   137   670   682   354   594   238   471    38    22    10    89   278   477   704   501   645   593   492   419    80   588   564   372 17   410   596   118   432    88   311   600   328   401   297    56   450   312   697   622   302   424   170   555   232   237   125   558   223   661   327   219   380    50   651 261   628   605   184   100   701    75   662   276    78   195   603   398   433   115   572   519   323    25   239   269   283   149   285   214    41   349   691   309   591    36 462   677   599   468   387   317    16   107    86   248   478   213   571   543   464    82   245   310   277   415   375   515   119   532   702   496   611   531   643   294   369 547   394   333   202     9   111   706   679    54   502   106   140];\r\n\r\n\r\nboard=fliplr(boardz);\r\nlimit=7250;\r\n[moves vine] = solver_1D_vine(board,limit);\r\nresult_expected=20244;\r\n    \r\n    Pass=1;\r\n    btemp=board;\r\n    for m=1:length(moves)\r\n     btemp(moves(m,2))=btemp(moves(m,1));\r\n     btemp(moves(m,1))=0; \r\n    end\r\n    bvec=btemp(vine); % expected to be increasing\r\n    dmin=min(bvec(2:end)-bvec(1:end-1));\r\n    result=sum(btemp(vine))\r\n\r\n    if dmin\u003c0\r\n     fprintf('Not Pass: Non-increasing seq\\n')\r\n     Pass=0;\r\n    end\r\n    if length(moves)\u003elimit\r\n     fprintf('Not Pass: %i moves used: Limit %i\\n',length(moves),limit)\r\n     Pass=0;\r\n    end\r\n    if result\u003c0.9*result_expected\r\n     fprintf('Not Pass: Score %i  Less than expected  %i\\n',result, 0.9*result_expected)\r\n     Pass=0;\r\n    end\r\n    \r\nassert(isequal(Pass,1))\r\n%%\r\nglobal boardz\r\nboard=boardz;\r\nlimit=7250;\r\n[moves vine] = solver_1D_vine(board,limit);\r\nresult_expected=20244;\r\n    \r\n    Pass=1;\r\n    btemp=board;\r\n    for m=1:length(moves)\r\n     btemp(moves(m,2))=btemp(moves(m,1));\r\n     btemp(moves(m,1))=0; \r\n    end\r\n    bvec=btemp(vine); % expected to be increasing\r\n    dmin=min(bvec(2:end)-bvec(1:end-1));\r\n    result=sum(btemp(vine))\r\n\r\n    if dmin\u003c0\r\n     fprintf('Not Pass: Non-increasing seq\\n')\r\n     Pass=0;\r\n    end\r\n    if length(moves)\u003elimit\r\n     fprintf('Not Pass: %i moves used: Limit %i\\n',length(moves),limit)\r\n     Pass=0;\r\n    end\r\n    if result\u003c0.9*result_expected\r\n     fprintf('Not Pass: Score %i  Less than expected  %i\\n',result, 0.9*result_expected)\r\n     Pass=0;\r\n    end\r\n    \r\nassert(isequal(Pass,1))\r\n%%\r\nglobal boardz\r\nboard=boardz;\r\nlimit=6681;\r\n[moves vine] = solver_1D_vine(board,limit);\r\nresult_expected=20167;\r\n    \r\n    Pass=1;\r\n    btemp=board;\r\n    for m=1:length(moves)\r\n     btemp(moves(m,2))=btemp(moves(m,1));\r\n     btemp(moves(m,1))=0; \r\n    end\r\n    bvec=btemp(vine); % expected to be increasing\r\n    dmin=min(bvec(2:end)-bvec(1:end-1));\r\n    result=sum(btemp(vine))\r\n\r\n    if dmin\u003c0\r\n     fprintf('Not Pass: Non-increasing seq\\n')\r\n     Pass=0;\r\n    end\r\n    if length(moves)\u003elimit\r\n     fprintf('Not Pass: %i moves used: Limit %i\\n',length(moves),limit)\r\n     Pass=0;\r\n    end\r\n    if result\u003c0.9*result_expected\r\n     fprintf('Not Pass: Score %i  Less than expected  %i\\n',result, 0.9*result_expected)\r\n     Pass=0;\r\n    end\r\n    \r\nassert(isequal(Pass,1))\r\n%%\r\nglobal boardz\r\nboard=boardz;\r\nlimit=1000;\r\n[moves vine] = solver_1D_vine(board,limit);\r\nresult_expected=13048;\r\n    \r\n    Pass=1;\r\n    btemp=board;\r\n    for m=1:length(moves)\r\n     btemp(moves(m,2))=btemp(moves(m,1));\r\n     btemp(moves(m,1))=0; \r\n    end\r\n    bvec=btemp(vine); % expected to be increasing\r\n    dmin=min(bvec(2:end)-bvec(1:end-1));\r\n    result=sum(btemp(vine))\r\n\r\n    if dmin\u003c0\r\n     fprintf('Not Pass: Non-increasing seq\\n')\r\n     Pass=0;\r\n    end\r\n    if length(moves)\u003elimit\r\n     fprintf('Not Pass: %i moves used: Limit %i\\n',length(moves),limit)\r\n     Pass=0;\r\n    end\r\n    if result\u003c0.9*result_expected\r\n     fprintf('Not Pass: Score %i  Less than expected  %i\\n',result, 0.9*result_expected)\r\n     Pass=0;\r\n    end\r\n    \r\nassert(isequal(Pass,1))\r\n%%\r\nglobal boardz\r\nboard=fliplr(boardz);\r\nlimit=0;\r\n[moves vine] = solver_1D_vine(board,limit);\r\nresult_expected=2564;\r\n    \r\n    Pass=1;\r\n    btemp=board;\r\n    for m=1:length(moves)\r\n     btemp(moves(m,2))=btemp(moves(m,1));\r\n     btemp(moves(m,1))=0; \r\n    end\r\n    bvec=btemp(vine); % expected to be increasing\r\n    dmin=min(bvec(2:end)-bvec(1:end-1));\r\n    result=sum(btemp(vine))\r\n\r\n    if dmin\u003c0\r\n     fprintf('Not Pass: Non-increasing seq\\n')\r\n     Pass=0;\r\n    end\r\n    if length(moves)\u003elimit\r\n     fprintf('Not Pass: %i moves used: Limit %i\\n',length(moves),limit)\r\n     Pass=0;\r\n    end\r\n    if result\u003c0.9*result_expected\r\n     fprintf('Not Pass: Score %i  Less than expected  %i\\n',result, 0.9*result_expected)\r\n     Pass=0;\r\n    end\r\n    \r\nassert(isequal(Pass,1))\r\n%%\r\nglobal boardz\r\nboard=boardz;\r\nlimit=10000;\r\n[moves vine] = solver_1D_vine(board,limit);\r\nresult_expected=20244;\r\n    \r\n    Pass=1;\r\n    btemp=board;\r\n    for m=1:length(moves)\r\n     btemp(moves(m,2))=btemp(moves(m,1));\r\n     btemp(moves(m,1))=0; \r\n    end\r\n    bvec=btemp(vine); % expected to be increasing\r\n    dmin=min(bvec(2:end)-bvec(1:end-1));\r\n    result=sum(btemp(vine))\r\n\r\n    if dmin\u003c0\r\n     fprintf('Not Pass: Non-increasing seq\\n')\r\n     Pass=0;\r\n    end\r\n    if length(moves)\u003elimit\r\n     fprintf('Not Pass: %i moves used: Limit %i\\n',length(moves),limit)\r\n     Pass=0;\r\n    end\r\n    if result\u003c0.9*result_expected\r\n     fprintf('Not Pass: Score %i  Less than expected  %i\\n',result, 0.9*result_expected)\r\n     Pass=0;\r\n    end\r\n    \r\nassert(isequal(Pass,1))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-05-10T16:36:20.000Z","updated_at":"2012-05-17T18:46:31.000Z","published_at":"2012-05-16T23:50:10.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Vine contest was to slide tiles around and then identify a vine of increasing values that are four point connected with no repeats. See the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/contest/contests/34\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eVine contest\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e for full details.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis challenge is specifically for the linear [1 n] case.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis did not exist in the competition suite but did in the test suite as brd 78. The 1-D case was not optimized during the contest.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eInput b = [1 5 2 3 1 2 8] ..limit 2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOutput: v=[3 4 5] and moves =[7 6;6 5] making [1 5 2 3 8 0 0]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eScore is 13.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe board may be flipped LR but will always be a row.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e..............................................Limit 10000....7250...6681....1000........0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNieto-Castanon Winning Code:...5705...5705...5705....3114 2564\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOptimal Score values...................20244 20244 20167 13048 2564\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"term":"tag:\"vines\"","current_player_id":null,"fields":[{"name":"page","type":"integer","callback":null,"default":1,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"per_page","type":"integer","callback":null,"default":50,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"sort","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"body","type":"text","callback":null,"default":"*:*","directive":null,"facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":false},{"name":"group","type":"string","callback":null,"default":null,"directive":"group","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"difficulty_rating_bin","type":"string","callback":null,"default":null,"directive":"difficulty_rating_bin","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"id","type":"integer","callback":null,"default":null,"directive":"id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"tag","type":"string","callback":null,"default":null,"directive":"tag","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"product","type":"string","callback":null,"default":null,"directive":"product","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_at","type":"timeframe","callback":{},"default":null,"directive":"created_at","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"profile_id","type":"integer","callback":null,"default":null,"directive":"author_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_by","type":"string","callback":null,"default":null,"directive":"author","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player_id","type":"integer","callback":null,"default":null,"directive":"solver_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player","type":"string","callback":null,"default":null,"directive":"solver","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"solvers_count","type":"integer","callback":null,"default":null,"directive":"solvers_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"comments_count","type":"integer","callback":null,"default":null,"directive":"comments_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"likes_count","type":"integer","callback":null,"default":null,"directive":"likes_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leader_id","type":"integer","callback":null,"default":null,"directive":"leader_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leading_solution","type":"integer","callback":null,"default":null,"directive":"leading_solution","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true}],"filters":[{"name":"asset_type","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":"\"cody:problem\"","prepend":true},{"name":"profile_id","type":"integer","callback":{},"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":"author_id","static":null,"prepend":true}],"query":{"params":{"per_page":50,"term":"tag:\"vines\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"vines\"","","\"","vines","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fac1ef80148\u003e":null,"#\u003cMathWorks::Search::Field:0x00007fac1ef800a8\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007fac44e3f790\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fac1ef803c8\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fac1ef80328\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fac1ef80288\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fac1ef801e8\u003e":"tag:\"vines\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fac1ef801e8\u003e":"tag:\"vines\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"search","password":"J3bGPZzQ7asjJcCk","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"vines\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"vines\"","","\"","vines","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fac1ef80148\u003e":null,"#\u003cMathWorks::Search::Field:0x00007fac1ef800a8\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007fac44e3f790\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fac1ef803c8\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fac1ef80328\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fac1ef80288\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fac1ef801e8\u003e":"tag:\"vines\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fac1ef801e8\u003e":"tag:\"vines\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":677,"difficulty_rating":"unrated"}]}}