เลียนแบบการสั่งซื้อ
กำหนดตัวเลขสองรายการแหล่งที่มาและรูปแบบจัดลำดับแหล่งใหม่เพื่อให้ตรงกับการเรียงลำดับสัมพัทธ์ของรูปแบบ รายการสองรายการของแหล่งที่มาของการเรียงลำดับควรเปรียบเทียบวิธีเดียวกันกับรายการที่ตำแหน่งเดียวกันของรูปแบบ ตัวอย่างเช่นการป้อนข้อมูล s = [-5, 9, 4, 13, 11, -6, 0] p = [7, -4, 1, -8, 4, -3, 12] ควรสร้างผลลัพธ์ [11, -5, 4, -6, 9, 0, 13] การเปรียบเทียบตำแหน่งแรกและตำแหน่งสุดท้ายผลลัพธ์มี11<13ซึ่งตรงกับ7<12ในรูปแบบ อินพุต:รายการจำนวนเต็มสองรายการที่ไม่มีความยาวเท่ากัน แต่ละรายการจะไม่มีการทำซ้ำ ขึ้นอยู่กับคุณว่าจะให้แหล่งที่มาหรือรูปแบบก่อน เอาท์พุท:รายการที่จัดเรียงหมายเลขต้นฉบับใหม่เพื่อให้มีการเรียงลำดับสัมพัทธ์เหมือนกับหมายเลขรูปแบบ ลีดเดอร์บอร์ด: แสดงตัวอย่างรหัส var QUESTION_ID=62587,OVERRIDE_USER=20260;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/62587/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return …