{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-05-26T00:16:20.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":"2026-05-26T00: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":46576,"title":"Award medals to winners","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 246.167px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 123.083px; transform-origin: 407px 123.083px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 384px 8.16667px; transform-origin: 384px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA competition awards medals to the winners: gold to first place, silver to second place, and bronze to third place. In the case of ties, these rules apply:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 102.167px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 391px 51.0833px; transform-origin: 391px 51.0833px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"block-size: 40.8667px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 20.4333px; text-align: left; transform-origin: 363px 20.4333px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 362.483px 8.16667px; transform-origin: 362.483px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIf two competitors tie for gold, the next competitor gets bronze, and no silver is awarded. If three or more competitors tie for gold, no other medals are awarded.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 190.967px 8.16667px; transform-origin: 190.967px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIf two or more competitors tie for silver, no bronze is awarded.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 40.8667px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 20.4333px; text-align: left; transform-origin: 363px 20.4333px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 347.725px 8.16667px; transform-origin: 347.725px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIf two or more competitors tie for bronze and fewer than three medals have been awarded so far, all who tied for bronze get medals.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 360.817px 8.16667px; transform-origin: 360.817px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that takes a vector of scores and identifies the winners (i.e., the position of the winning scores in the vector).  In this competition, higher scores are better. If a medal is not awarded, set the output to the empty set. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 145.983px 8.16667px; transform-origin: 145.983px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eP.S.: For a competition with different rules, see \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/46573-determine-the-winner-of-a-goofy-golf-tournament\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problem 46573\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.94167px 8.16667px; transform-origin: 1.94167px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [w1,w2,w3] = medalists(x)\r\n   w1 = ...;   %  Gold\r\n   w2 = ...;   %  Silver\r\n   w3 = ...;   %  Bronze\r\nend","test_suite":"%%\r\nx = [1 5 2 6 3 7];\r\n[w1_correct,w2_correct,w3_correct] = deal(6,4,2);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))\r\n\r\n%%\r\nx = [12 20 14 50 33 50 8 1];\r\n[w1_correct,w2_correct,w3_correct] = deal([4 6],[],[5]);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))\r\n\r\n%%\r\nx = [33 33 33 12 20 14 50 33 50 8 1];\r\n[w1_correct,w2_correct,w3_correct] = deal([7 9],[],[1 2 3 8]);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))\r\n\r\n%%\r\nx = [9 8 8 9 1 3 4 2 3 9];\r\n[w1_correct,w2_correct,w3_correct] = deal([1 4 10],[],[]);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))\r\n\r\n%%\r\nx = [9 8 8 9 1 10 3 4 2 3 9];\r\n[w1_correct,w2_correct,w3_correct] = deal(6,[1 4 11],[]);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))\r\n\r\n%%\r\nx = [9 8 8 9 1 3 4 2 3 9 0 -1 15 pi 12];\r\n[w1_correct,w2_correct,w3_correct] = deal(13,15,[1 4 10]);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))\r\n\r\n%% \r\nx = [1 5 2 5 3 5 4 5];\r\n[w1_correct,w2_correct,w3_correct] = deal([2 4 6 8],[],[]);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":14,"test_suite_updated_at":"2020-10-02T21:23:33.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-09-06T22:20:31.000Z","updated_at":"2026-05-30T15:30:27.000Z","published_at":"2020-09-06T22:40:37.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA competition awards medals to the winners: gold to first place, silver to second place, and bronze to third place. In the case of ties, these rules apply:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf two competitors tie for gold, the next competitor gets bronze, and no silver is awarded. If three or more competitors tie for gold, no other medals are awarded.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf two or more competitors tie for silver, no bronze is awarded.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf two or more competitors tie for bronze and fewer than three medals have been awarded so far, all who tied for bronze get medals.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function that takes a vector of scores and identifies the winners (i.e., the position of the winning scores in the vector).  In this competition, higher scores are better. If a medal is not awarded, set the output to the empty set. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eP.S.: For a competition with different rules, see \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/46573-determine-the-winner-of-a-goofy-golf-tournament\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problem 46573\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"}],"problem_search":{"problems":[{"id":46576,"title":"Award medals to winners","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 246.167px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 123.083px; transform-origin: 407px 123.083px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 384px 8.16667px; transform-origin: 384px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA competition awards medals to the winners: gold to first place, silver to second place, and bronze to third place. In the case of ties, these rules apply:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 102.167px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 391px 51.0833px; transform-origin: 391px 51.0833px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"block-size: 40.8667px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 20.4333px; text-align: left; transform-origin: 363px 20.4333px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 362.483px 8.16667px; transform-origin: 362.483px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIf two competitors tie for gold, the next competitor gets bronze, and no silver is awarded. If three or more competitors tie for gold, no other medals are awarded.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 190.967px 8.16667px; transform-origin: 190.967px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIf two or more competitors tie for silver, no bronze is awarded.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 40.8667px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 20.4333px; text-align: left; transform-origin: 363px 20.4333px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 347.725px 8.16667px; transform-origin: 347.725px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIf two or more competitors tie for bronze and fewer than three medals have been awarded so far, all who tied for bronze get medals.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 360.817px 8.16667px; transform-origin: 360.817px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that takes a vector of scores and identifies the winners (i.e., the position of the winning scores in the vector).  In this competition, higher scores are better. If a medal is not awarded, set the output to the empty set. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 145.983px 8.16667px; transform-origin: 145.983px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eP.S.: For a competition with different rules, see \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/46573-determine-the-winner-of-a-goofy-golf-tournament\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problem 46573\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.94167px 8.16667px; transform-origin: 1.94167px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [w1,w2,w3] = medalists(x)\r\n   w1 = ...;   %  Gold\r\n   w2 = ...;   %  Silver\r\n   w3 = ...;   %  Bronze\r\nend","test_suite":"%%\r\nx = [1 5 2 6 3 7];\r\n[w1_correct,w2_correct,w3_correct] = deal(6,4,2);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))\r\n\r\n%%\r\nx = [12 20 14 50 33 50 8 1];\r\n[w1_correct,w2_correct,w3_correct] = deal([4 6],[],[5]);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))\r\n\r\n%%\r\nx = [33 33 33 12 20 14 50 33 50 8 1];\r\n[w1_correct,w2_correct,w3_correct] = deal([7 9],[],[1 2 3 8]);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))\r\n\r\n%%\r\nx = [9 8 8 9 1 3 4 2 3 9];\r\n[w1_correct,w2_correct,w3_correct] = deal([1 4 10],[],[]);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))\r\n\r\n%%\r\nx = [9 8 8 9 1 10 3 4 2 3 9];\r\n[w1_correct,w2_correct,w3_correct] = deal(6,[1 4 11],[]);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))\r\n\r\n%%\r\nx = [9 8 8 9 1 3 4 2 3 9 0 -1 15 pi 12];\r\n[w1_correct,w2_correct,w3_correct] = deal(13,15,[1 4 10]);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))\r\n\r\n%% \r\nx = [1 5 2 5 3 5 4 5];\r\n[w1_correct,w2_correct,w3_correct] = deal([2 4 6 8],[],[]);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":14,"test_suite_updated_at":"2020-10-02T21:23:33.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-09-06T22:20:31.000Z","updated_at":"2026-05-30T15:30:27.000Z","published_at":"2020-09-06T22:40:37.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA competition awards medals to the winners: gold to first place, silver to second place, and bronze to third place. In the case of ties, these rules apply:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf two competitors tie for gold, the next competitor gets bronze, and no silver is awarded. If three or more competitors tie for gold, no other medals are awarded.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf two or more competitors tie for silver, no bronze is awarded.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf two or more competitors tie for bronze and fewer than three medals have been awarded so far, all who tied for bronze get medals.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function that takes a vector of scores and identifies the winners (i.e., the position of the winning scores in the vector).  In this competition, higher scores are better. If a medal is not awarded, set the output to the empty set. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eP.S.: For a competition with different rules, see \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/46573-determine-the-winner-of-a-goofy-golf-tournament\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problem 46573\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"}],"errors":[],"facets":[[],[{"value":"medium","count":1,"selected":false}]],"term":"tag:\"olympics\"","page":1,"per_page":50,"sort":"map(difficulty_value,0,0,999) asc"}}