合肥生活安徽新聞合肥交通合肥房產(chǎn)生活服務(wù)合肥教育合肥招聘合肥旅游文化藝術(shù)合肥美食合肥地圖合肥社保合肥醫(yī)院企業(yè)服務(wù)合肥法律

        代寫(xiě)Implementation of Graph Algorithms

        時(shí)間:2023-11-14  來(lái)源:合肥網(wǎng)hfw.cc  作者:hfw.cc 我要糾錯(cuò)


        C++ Implementation of Graph Algorithms

        1 Task Description

        You are asked to use C++ to solve the following puzzle.

        Hint: All it takes is an algorithm mentioned in this course (with a slight twist).

        The graph is undirected!

        2 Submission Guideline

        You must follow this guideline! Your submission will be marked automatically. Failure to

        follow this guideline will result in 0.

        Your submission should contain exactly one file: main.cpp.

        You do not need to submit a design.

        3 Puzzle

        You need to redesign the road system of an imaginary country.

        The country is composed of N cities (for simplicity numbered from 0 to N − 1). Some pairs of cities are

        connected by bidirectional roads. We say that there is a path between different cities A and B if there exists

        a sequence of unique cities C1, C2, . . . , CM, such that C1 = A and CM = B and for each index i < M, there

        is a road between cities Ci and Ci+1.

        The current state of the road network is miserable. Some pairs of cities are not connected by any path. On

        the other hand, other pairs of cities are connected by multiple different paths, and that leads to complicated

        traffic routing. You want to build some new roads and destroy some of the already existing roads in the

        country so that after the reconstruction there will exist exactly one path between every pair of distinct cities.

        As building new roads and destroying old ones costs a lot of money, you want to minimize the total cost

        spent on the reconstruction.

        You are given three two-dimensional arrays:

        • country[i][j]=1 or 0: there is an existing road between city i and j if and only if country[i][j]=1.

        • build[i][j]: the cost for building a road between i and j. The values of build[i][j] are represented

        using English letters. A, B, . . . , Z represent 0, 1, . . . , 25 and a, b, . . . , z represent 26, 27, . . . , 51. For

        example, if build[2][4]=b, then that means the cost for building a road between city 2 and city 4 is

        27.

        • destroy[i][j]: the cost for destroying a road between i and j. Again, the values are represented

        using English letters like the above.

        Your task is to find and print the minimal cost needed for the road network reconstruction.

        You don’t need to worry about invalid inputs.

        1

        • Sample input 1: 000,000,000 ABD,BAC,DCA ABD,BAC,DCA

        Note: 000,000,000 describes the two-dimensional array country. ABD,BAC,DCA describes the twodimensional array build. ABD,BAC,DCA describes the two-dimensional array destroy. The input

        format is: three strings separated by spaces; each string contains N parts separated by commas; each

        part contains N characters.

        Sample output 1: 3

        Comment: There are three cities, totally disconnected.

        • Sample input 2: 011,101,110 ABD,BAC,DCA ABD,BAC,DCA

        Sample output 2: 1

        Comment: Now the three cities form a connected triangle and we need to destroy one road. Optimal

        solution is to destroy the road between the cities 0-1 (cost 1).

        • Sample input 3: (note: all inputs are on the same line. I just couldn’t fit them in one line in this pdf.)

        011000,101000,110000,000011,000101,000110

        ABDFFF,BACFFF,DCAFFF,FFFABD,FFFBAC,FFFDCA

        ABDFFF,BACFFF,DCAFFF,FFFABD,FFFBAC,FFFDCA

        Sample output 3: 7

        Comment: We have six cities forming two separate triangles. Destroy one road in each triangle (costs

        1 for each road) and then join the triangles by a new road (costs 5).

        • Sample input 4: 0 A A

        Sample output 4: 0

        Comment: One city is okay just as it is.

        • Sample input 5: 0001,0001,0001,1110 AfOj,fAcC,OcAP,jCPA AWFH,WAxU,FxAV,HUVA

        Sample output 5: 0

        Comment: We have four cities, which are connected in such a way that there is exactly one path

        between each two cities.

        Thus there is nothing to reconstruct.

        4 Marking

        Marking will be done automatically. The total mark is 10 (1 for compiling and 9 for 9 test cases).

        5 Websubmission

        You are asked to submit via the web interface https://cs.adelaide.edu.au/services/websubmission/.

        The submission steps should be self-explanatory. Simply choose the correct semester, course, and assignment.

        The websubmission system will automatically fetch the latest version of your work from your SVN repository

        (you may also choose to submit older versions). Once your work is submitted, the system will launch a

        script checking the format of your submission. Click “View Feedback” to view the results. Your mark will

        be calculated offline after the deadline. You are welcome to resubmit for as many times as you wish (before

        the deadline).

        We will compile your code using g++ -o main.out -std=c++11 -O2 -Wall main.cpp. It is your responsibility to ensure that your code compiles on the university system.

        1

        1g++ has too many versions, so being able to compile on your laptop does not guarantee that it compiles on the university

        system. You are encouraged to debug your code on a lab computer (or use SSH).

        加QQ:99515681 或郵箱:99515681@qq.com   WX:codehelp

         

        掃一掃在手機(jī)打開(kāi)當(dāng)前頁(yè)
      1. 上一篇:代寫(xiě)CMPT 125、c++設(shè)計(jì)編程代做
      2. 下一篇:代寫(xiě)CS170編程、代做Java程序設(shè)計(jì)
      3. 無(wú)相關(guān)信息
        合肥生活資訊

        合肥圖文信息
        挖掘機(jī)濾芯提升發(fā)動(dòng)機(jī)性能
        挖掘機(jī)濾芯提升發(fā)動(dòng)機(jī)性能
        戴納斯帝壁掛爐全國(guó)售后服務(wù)電話24小時(shí)官網(wǎng)400(全國(guó)服務(wù)熱線)
        戴納斯帝壁掛爐全國(guó)售后服務(wù)電話24小時(shí)官網(wǎng)
        菲斯曼壁掛爐全國(guó)統(tǒng)一400售后維修服務(wù)電話24小時(shí)服務(wù)熱線
        菲斯曼壁掛爐全國(guó)統(tǒng)一400售后維修服務(wù)電話2
        美的熱水器售后服務(wù)技術(shù)咨詢電話全國(guó)24小時(shí)客服熱線
        美的熱水器售后服務(wù)技術(shù)咨詢電話全國(guó)24小時(shí)
        海信羅馬假日洗衣機(jī)亮相AWE  復(fù)古美學(xué)與現(xiàn)代科技完美結(jié)合
        海信羅馬假日洗衣機(jī)亮相AWE 復(fù)古美學(xué)與現(xiàn)代
        合肥機(jī)場(chǎng)巴士4號(hào)線
        合肥機(jī)場(chǎng)巴士4號(hào)線
        合肥機(jī)場(chǎng)巴士3號(hào)線
        合肥機(jī)場(chǎng)巴士3號(hào)線
        合肥機(jī)場(chǎng)巴士2號(hào)線
        合肥機(jī)場(chǎng)巴士2號(hào)線
      4. 幣安app官網(wǎng)下載 短信驗(yàn)證碼

        關(guān)于我們 | 打賞支持 | 廣告服務(wù) | 聯(lián)系我們 | 網(wǎng)站地圖 | 免責(zé)聲明 | 幫助中心 | 友情鏈接 |

        Copyright © 2024 hfw.cc Inc. All Rights Reserved. 合肥網(wǎng) 版權(quán)所有
        ICP備06013414號(hào)-3 公安備 42010502001045

        主站蜘蛛池模板: 冲田杏梨AV一区二区三区| 一区二区日韩国产精品| 国产成人一区二区动漫精品| 果冻传媒一区二区天美传媒| 免费无码一区二区三区| 一区在线观看视频| 伊人无码精品久久一区二区| 亚洲永久无码3D动漫一区| 精品无码成人片一区二区| 无码人妻一区二区三区免费手机| 色噜噜AV亚洲色一区二区| 国产在线精品一区在线观看| 激情亚洲一区国产精品| 亚洲AV无码一区东京热| 色精品一区二区三区| 综合一区自拍亚洲综合图区| 国产精品高清一区二区三区不卡| 国产综合一区二区| 波多野结衣免费一区视频| www一区二区三区| 日韩精品人妻av一区二区三区| 蜜桃AV抽搐高潮一区二区| 精品欧洲av无码一区二区| 日本在线不卡一区| 国产人妖视频一区二区| 中文字幕一精品亚洲无线一区| 国产婷婷色一区二区三区深爱网 | 无码成人一区二区| 日韩精品人妻一区二区中文八零 | 又紧又大又爽精品一区二区| 天天视频一区二区三区| 无码少妇丰满熟妇一区二区| 亚洲高清一区二区三区| 亚洲av无码一区二区三区人妖 | 狠狠做深爱婷婷综合一区| 一区二区三区91| 国产精品自在拍一区二区不卡| 成人区人妻精品一区二区不卡网站| 精品一区二区三区3d动漫| 无码AⅤ精品一区二区三区| 国产精品无码一区二区在线观一|