


下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、題目來源: USACO Open 2002者:情況:搜索可以解決一些數(shù)據(jù)理由: 不知道可不可以用動(dòng)態(tài)規(guī)劃,即使是 NP,搜索優(yōu)化也是一個(gè)值得。PROBLEM 3: Circus Tickets Gadnell & Backmolstad, 1997Farmer John is taking 16 cows to see the three ring circus.Being cows,they are seatedhe cow section, a 4x4 set of seats near the front ofthe audience.The seats, rows, and colum
2、ns are numbered thusly:col 1col 3| col 2 | col 4| 15913|261014371115481216- row 1- row 2- row 3- row 4The cows are herded helter-skeltero the seats.It is only after theyare seatedt they check their tickets.In a revelationt willsurprise no one, they are not nesarilyhe proper seats.The layoutof the co
3、w seating icht they can rearrange themselves only byroing a row right or left or roing a column up or down.The exlesbelow show all four operations appproper seating shown above:d to therow or column of the4162738259361047118129678111216131415Rot row 1 rightRot row 1 leftRot col 1 upRot col 1 downGiv
4、en the initial seating arrangement of the cows, determine a very goodset of roions to rearrange cows sot their tickets and seat numbersmatch.east one solution always exists.Your score for each test case will depend on how close you get to the bestnumber of roionbmitted by other contestants fort case
5、.Youroutput sequence must be shortercredit for this problem.n 500 operations in order to receiveH: The sequence 1l 1l 1l 4u 1r 4d 1l 1l 4u 1r 4u 4u 4u swaps the upperleft cow with the cow to her right.PROBLEM NAME: tixINPUT FORMAT:Four lines, each with four spaeparatedegers.Line 1 is therow; line 2
6、is the second row; and so on.SLE INPUT (file tix.in):4 1 2 36 7 8 510 11 12 914 15 16 13OUTPUT FORMAT:A series of output linest contahe ordered sequence of roionst will arrange the cows.Each line contains a row or column number(1.4) followed by a space followed by a lower-case lettert indicatesthe o
7、peration to be performed: r for roe a row right, l for roea row left, u for roe a column up, and d for roe a column down.SLE OUTPUT (file tix.out):lrrrOther correct sequenpos.are equally valid though might not garner as many馬戲團(tuán)入場(chǎng)券Gadnell & Backmolstad, 1997Farmer John 要帶 16 只母牛去看雜技,母牛們將坐在觀眾前附近的一個(gè) 4x
8、4 座的牛區(qū)。所有座位、行、圖標(biāo)上數(shù)字。1 列3 列| 159132 列 |4 列|261014371115481216- 1 行- 2 行- 3 行- 4 行母牛們隨機(jī)坐在位置上,等它們坐下之后才進(jìn)行檢票。很明顯,它們沒有必要坐在合適的位置上,位置已被設(shè)計(jì)成可以左右轉(zhuǎn)一行或上下轉(zhuǎn)一列。下面的例子說明了由上面的狀態(tài)經(jīng)過4 種轉(zhuǎn)動(dòng)操作所到達(dá)的目標(biāo)狀態(tài)。4162738259361047118129678111216下轉(zhuǎn)第 1 列131415右轉(zhuǎn)第 1 行左轉(zhuǎn)第 1 行上轉(zhuǎn)第 1 列給定牛的原始位置,用較少的旋轉(zhuǎn)次數(shù)將牛重排,使得他們的入場(chǎng)券與座位號(hào)相符。無論原始位置如何,總有至少一種可行方案。你的每個(gè)測(cè)試點(diǎn)的成績(jī)?nèi)Q于你的方案與所有選手的最優(yōu)方案的接近程度。你的輸出序列必須少于 500 個(gè)操作。提示:序列 1l 1l 1l 4u 1r 4d 1l 1l 4u 1r 4u 4u 4u 交換了左上角的牛與它右邊的牛。程序名:tix輸入格式:4 行,每行 4 個(gè)數(shù)一行是坐在第一行的牛,第二行是坐在第二行的牛等等。輸入樣例(tix.in):4 1 2 36 7
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 拱橋:剛性系桿工程現(xiàn)場(chǎng)質(zhì)量檢驗(yàn)報(bào)告單
- 油印機(jī)批發(fā)企業(yè)縣域市場(chǎng)拓展與下沉戰(zhàn)略研究報(bào)告
- 球類運(yùn)動(dòng)用品和器材百貨企業(yè)縣域市場(chǎng)拓展與下沉戰(zhàn)略研究報(bào)告
- 內(nèi)河冷藏船貨運(yùn)企業(yè)縣域市場(chǎng)拓展與下沉戰(zhàn)略研究報(bào)告
- 銅雕藝術(shù)制作工具企業(yè)ESG實(shí)踐與創(chuàng)新戰(zhàn)略研究報(bào)告
- 乙類卷煙企業(yè)ESG實(shí)踐與創(chuàng)新戰(zhàn)略研究報(bào)告
- 二零二五年度保姆聘用合同家政服務(wù)人員培訓(xùn)及考核標(biāo)準(zhǔn)協(xié)議
- 二零二五年度酒店市場(chǎng)營銷及推廣合作協(xié)議
- 2025年度特色餐飲店開業(yè)運(yùn)營管理合同
- 2025年度智能家居砌墻抹灰一體化施工合同
- 2025年上半年宜賓江安縣人社局招考易考易錯(cuò)模擬試題(共500題)試卷后附參考答案
- 2024年批次杭州市教育局所屬事業(yè)單位招聘筆試真題
- 2024年海東市第二人民醫(yī)院自主招聘專業(yè)技術(shù)人員考試真題
- 《VAVE價(jià)值工程》課件 - 創(chuàng)造最大化的價(jià)值與效益
- 中醫(yī)養(yǎng)生保健知識(shí)科普
- 社區(qū)居委會(huì)2025年工作總結(jié)暨2025年工作計(jì)劃
- 2024年天翼云認(rèn)證運(yùn)維工程師考試復(fù)習(xí)題庫(含答案)
- 水果聯(lián)營合同范例
- 江蘇卷2024年高考語文第一次模擬考試一(原卷版+解析版)
- 實(shí)驗(yàn)室儀器設(shè)備售后服務(wù)承諾書(7篇)
- 《主管技能訓(xùn)練》課件
評(píng)論
0/150
提交評(píng)論