青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

posts - 74,  comments - 33,  trackbacks - 0
Islands and Bridges
Time Limit: 4000MS Memory Limit: 65536K
Total Submissions: 2930 Accepted: 723

Description

Given a map of islands and bridges that connect these islands, a Hamilton path, as we all know, is a path along the bridges such that it visits each island exactly once. On our map, there is also a positive integer value associated with each island. We call a Hamilton path the best triangular Hamilton path if it maximizes the value described below.

Suppose there are n islands. The value of a Hamilton path C1C2...Cn is calculated as the sum of three parts. Let Vi be the value for the island Ci. As the first part, we sum over all the Vi values for each island in the path. For the second part, for each edge CiCi+1 in the path, we add the product Vi*Vi+1. And for the third part, whenever three consecutive islands CiCi+1Ci+2 in the path forms a triangle in the map, i.e. there is a bridge between Ci and Ci+2, we add the product Vi*Vi+1*Vi+2.

Most likely but not necessarily, the best triangular Hamilton path you are going to find contains many triangles. It is quite possible that there might be more than one best triangular Hamilton paths; your second task is to find the number of such paths.

Input

The input file starts with a number q (q<=20) on the first line, which is the number of test cases. Each test case starts with a line with two integers n and m, which are the number of islands and the number of bridges in the map, respectively. The next line contains n positive integers, the i-th number being the Vi value of island i. Each value is no more than 100. The following m lines are in the form x y, which indicates there is a (two way) bridge between island x and island y. Islands are numbered from 1 to n. You may assume there will be no more than 13 islands.

Output

For each test case, output a line with two numbers, separated by a space. The first number is the maximum value of a best triangular Hamilton path; the second number should be the number of different best triangular Hamilton paths. If the test case does not contain a Hamilton path, the output must be `0 0'.

Note: A path may be written down in the reversed order. We still think it is the same path.

Sample Input

2
3 3
2 2 2
1 2
2 3
3 1
4 6
1 2 3 4
1 2
1 3
1 4
2 3
2 4
3 4

Sample Output

22 3
69 1
以前做本校的1005的時候,其中就用到TSP,當然KM也能正確求解,暴搜更是無敵!
現在這是一道變形的TSP,搞清題目意思就很容易求解,不幸的是在統計路徑的時候,我居然
腦殘的sum++,而應該是sum+=dpways[(1<<n)-1][i][j];因此白白的貢獻了N個WA,
腦殘人士!請見諒!
代碼很慢,735ms,不貼了!
-------------------------------------------------------------------------------------------
上課去了!!!
posted on 2009-03-26 09:56 KNIGHT 閱讀(133) 評論(0)  編輯 收藏 引用

只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


<2009年1月>
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567

常用鏈接

留言簿(8)

隨筆檔案

文章檔案

Friends

OJ

搜索

  •  

最新評論

閱讀排行榜

評論排行榜

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            欧美日韩精品一区二区三区四区| 久久天天躁狠狠躁夜夜av| 欧美日本一区| 一本色道88久久加勒比精品| 亚洲欧洲一区二区三区久久| 欧美精品一区二区三区蜜臀| 亚洲伦理精品| 亚洲视频图片小说| 国产伦精品一区二区三区免费迷| 欧美专区一区二区三区| 欧美夜福利tv在线| 91久久精品国产91久久性色tv | 一区免费视频| 亚洲黄色一区| 国产精品理论片在线观看| 久久九九国产精品怡红院| 看欧美日韩国产| 亚洲线精品一区二区三区八戒| 亚洲综合国产激情另类一区| 国产中文一区二区| 亚洲精品国产无天堂网2021| 国产精品久久久久久久第一福利| 久久久www成人免费毛片麻豆| 免费视频久久| 亚洲欧美在线一区| 久久综合久久综合九色| 亚洲自拍另类| 美女视频黄 久久| 欧美在线www| 欧美国产日本高清在线| 久久国产精品久久精品国产| 欧美高清视频一区二区三区在线观看| 亚洲伊人网站| 欧美成黄导航| 久久深夜福利免费观看| 欧美视频精品在线| 欧美aⅴ一区二区三区视频| 国产精品久久久久久久久果冻传媒| 久久久久久一区二区| 欧美日韩综合视频网址| 欧美α欧美αv大片| 国产精品视频xxxx| 亚洲人成绝费网站色www| 国内成人精品视频| 亚洲一区二区精品| 一本久久a久久精品亚洲| 久久免费视频在线| 欧美在线免费观看亚洲| 欧美婷婷久久| 亚洲麻豆一区| 日韩网站在线观看| 美女主播精品视频一二三四| 久久精品五月婷婷| 国产精品一区二区女厕厕| 99国产精品久久| 日韩一级大片在线| 欧美精品福利| 亚洲韩国精品一区| 亚洲精品免费一二三区| 另类春色校园亚洲| 免费观看亚洲视频大全| 精品96久久久久久中文字幕无| 亚洲欧美日韩一区二区三区在线观看 | 一区免费视频| 久久精品亚洲一区| 久久亚洲精品中文字幕冲田杏梨| 国产欧美va欧美va香蕉在| 亚洲一区日韩| 欧美中在线观看| 国产视频久久网| 久久gogo国模啪啪人体图| 久久久久国产一区二区| 国产一区二区主播在线| 久久精品国产99国产精品澳门 | 亚洲线精品一区二区三区八戒| 欧美精品电影| 中日韩视频在线观看| 亚洲欧美日韩视频一区| 国产区欧美区日韩区| 性欧美精品高清| 美女图片一区二区| 亚洲九九爱视频| 国产精品成人国产乱一区| 亚洲一区二区三区在线播放| 久久gogo国模啪啪人体图| 国产一区二三区| 欧美sm视频| 在线视频日韩| 狼人社综合社区| 亚洲美女中出| 国产欧美日本在线| 久久午夜电影| 一区二区精品国产| 欧美在线观看一区二区| 亚洲国产欧美日韩精品| 欧美日韩国产在线观看| 欧美一区二区三区在线视频| 欧美黄色免费| 亚洲免费在线| 一区精品久久| 国产精品成人播放| 久久免费视频在线观看| 一区二区国产在线观看| 麻豆国产精品va在线观看不卡| 99精品99| 伊人狠狠色j香婷婷综合| 欧美日韩在线综合| 久久精品国产精品 | 欧美一级淫片播放口| 亚洲高清久久| 国产老女人精品毛片久久| 蜜臀久久99精品久久久久久9| 亚洲视频在线一区| 欧美成人在线免费观看| 欧美在线视频观看| 夜夜嗨av色综合久久久综合网| 国产网站欧美日韩免费精品在线观看| 欧美国产乱视频| 久久精品国产清自在天天线| 这里只有精品丝袜| 亚洲精品国产精品国自产观看| 久久精品水蜜桃av综合天堂| 中文精品在线| 日韩视频永久免费| 激情综合色综合久久| 国产欧美视频一区二区三区| 欧美日韩高清免费| 免费久久精品视频| 久久精品日产第一区二区| 亚洲一区二区三区免费视频| 亚洲精品国产精品乱码不99| 欧美va天堂| 久久亚洲国产成人| 久久裸体视频| 久久久久免费视频| 久久久精品国产一区二区三区 | 亚洲精品字幕| 亚洲欧洲美洲综合色网| 在线看一区二区| 激情综合五月天| 极品少妇一区二区三区| 国产手机视频一区二区| 国产欧美一区二区三区国产幕精品 | 91久久久久久久久久久久久| 亚洲大片在线| 亚洲第一中文字幕在线观看| 欧美大学生性色视频| 欧美国产一区二区| 欧美gay视频激情| 欧美激情免费观看| 亚洲激情校园春色| 亚洲精选91| 亚洲色图制服丝袜| 亚洲欧美成人一区二区在线电影 | 久久av二区| 久久久久久久久一区二区| 久久久久久69| 欧美二区乱c少妇| 欧美日韩视频一区二区| 欧美四级在线观看| 国产区在线观看成人精品| 好看的日韩视频| 亚洲日韩中文字幕在线播放| a4yy欧美一区二区三区| 亚洲一线二线三线久久久| 欧美一级久久久| 免费看黄裸体一级大秀欧美| 亚洲国产综合在线看不卡| 国产精品99久久不卡二区| 香蕉国产精品偷在线观看不卡| 久久国产精品99精品国产| 免费在线观看日韩欧美| 欧美日韩一区二区三区四区在线观看| 国产精品久久婷婷六月丁香| 国内精品美女在线观看| 亚洲麻豆视频| 性欧美xxxx大乳国产app| 久久综合激情| 亚洲精品一区二区三区福利 | 欧美不卡视频| 日韩视频不卡| 久久精品天堂| 欧美日韩在线观看一区二区三区| 国产色综合天天综合网| 亚洲精品欧美| 久久久噜噜噜久久中文字免| 亚洲精品中文字幕女同| 欧美一级片一区| 欧美日韩欧美一区二区| 极品日韩久久| 午夜视频在线观看一区| 亚洲高清免费在线| 欧美一区激情| 国产精品草莓在线免费观看| 尤物在线精品| 久久久久久久高潮| 亚洲视频免费在线| 欧美极品一区二区三区| 在线成人中文字幕| 久久精品一区蜜桃臀影院|