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

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,當(dāng)然KM也能正確求解,暴搜更是無敵!
現(xiàn)在這是一道變形的TSP,搞清題目意思就很容易求解,不幸的是在統(tǒng)計(jì)路徑的時候,我居然
腦殘的sum++,而應(yīng)該是sum+=dpways[(1<<n)-1][i][j];因此白白的貢獻(xiàn)了N個WA,
腦殘人士!請見諒!
代碼很慢,735ms,不貼了!
-------------------------------------------------------------------------------------------
上課去了!??!
posted on 2009-03-26 09:56 KNIGHT 閱讀(129) 評論(0)  編輯 收藏 引用
<2009年3月>
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234

常用鏈接

留言簿(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>
            国产精品狼人久久影院观看方式| 久久久久久久久伊人| 欧美黄在线观看| 一本色道久久综合亚洲精品小说 | 欧美一区日韩一区| 国产有码一区二区| 欧美激情91| 欧美视频三区在线播放| 久久av在线看| 美女露胸一区二区三区| 一区二区三区欧美激情| 亚洲欧美国产高清va在线播| 激情婷婷久久| 日韩亚洲在线观看| 国产午夜一区二区三区| 欧美丰满少妇xxxbbb| 欧美性生交xxxxx久久久| 久久精品国产第一区二区三区最新章节| 久久不射2019中文字幕| 亚洲免费观看| 欧美一级黄色录像| 亚洲狼人综合| 欧美在线黄色| 亚洲一区制服诱惑| 老司机免费视频一区二区| 亚洲综合国产激情另类一区| 久久欧美中文字幕| 欧美亚洲视频在线看网址| 免费观看成人鲁鲁鲁鲁鲁视频| 亚洲一级黄色av| 久久这里只有| 欧美在线999| 欧美日一区二区在线观看| 老司机午夜精品视频在线观看| 欧美日韩人人澡狠狠躁视频| 久久综合久色欧美综合狠狠 | 亚洲国产裸拍裸体视频在线观看乱了 | 亚洲一区二区三| 欧美va亚洲va国产综合| 久久久久se| 国产精品激情偷乱一区二区∴| 欧美成人午夜激情视频| 国产一区免费视频| 亚洲一区二区三区成人在线视频精品 | 国产在线拍偷自揄拍精品| 亚洲精品日韩激情在线电影| 国产午夜亚洲精品不卡| 亚洲一区视频在线观看视频| 亚洲深夜福利在线| 免费在线观看精品| 久久综合999| 国产综合自拍| 亚洲国产精品精华液2区45| 一区二区电影免费观看| 一本色道**综合亚洲精品蜜桃冫 | …久久精品99久久香蕉国产 | 亚洲成色www久久网站| 国产亚洲精品aa| 小黄鸭精品密入口导航| 欧美一区二区三区另类| 国产精品久久久久毛片软件| 亚洲视频精品| 香蕉乱码成人久久天堂爱免费| 欧美婷婷六月丁香综合色| 一本高清dvd不卡在线观看| 一本久久a久久免费精品不卡| 欧美理论电影网| 99国产精品久久久久久久久久| 一本色道久久综合精品竹菊 | 欧美一区不卡| 国产午夜精品一区二区三区欧美 | 亚洲看片网站| 亚洲天堂偷拍| 国产精品一区二区男女羞羞无遮挡| 一区二区日韩精品| 欧美一区二区三区喷汁尤物| 国产精品一区免费观看| 久久成人精品| 欧美激情在线免费观看| 一区二区三区视频在线| 国产精品实拍| 久久久噜噜噜久久| 亚洲精品之草原avav久久| 亚洲欧美清纯在线制服| 韩国精品在线观看| 欧美成人蜜桃| 亚洲一区二区伦理| 免费在线亚洲| 亚洲一区二区三区涩| 国产午夜精品久久| 欧美激情一区二区三区不卡| 99视频精品| 免费日韩视频| 亚洲欧美高清| 最新国产乱人伦偷精品免费网站| 欧美性做爰猛烈叫床潮| 久久精品99久久香蕉国产色戒| 亚洲国产精品va在线看黑人动漫| 亚洲欧美国产高清| 91久久国产综合久久| 国产精品日韩精品欧美在线| 久久永久免费| 亚洲欧美视频一区| 亚洲精品日韩一| 蜜桃伊人久久| 欧美一级视频一区二区| 亚洲三级国产| 黄色亚洲精品| 国产精品丝袜xxxxxxx| 欧美国产激情| 久久精品国语| 午夜精品一区二区三区电影天堂| 亚洲黄色有码视频| 猛男gaygay欧美视频| 午夜精品久久久99热福利| 亚洲精品精选| 亚洲电影av在线| 欧美成人激情在线| 欧美在线观看一区二区三区| 亚洲伦理自拍| 亚洲国产婷婷| 在线观看一区二区精品视频| 国产伦精品一区二区三区视频黑人| 欧美国产欧美亚洲国产日韩mv天天看完整 | 亚洲国产精品成人精品| 国产又爽又黄的激情精品视频| 欧美日韩一视频区二区| 欧美韩日精品| 欧美大学生性色视频| 久久久亚洲影院你懂的| 欧美资源在线观看| 午夜亚洲精品| 性做久久久久久久免费看| 亚洲视频在线看| 中日韩美女免费视频网站在线观看| 亚洲国产导航| 亚洲二区视频在线| 亚洲第一区在线| 亚洲国产精品成人一区二区| 欧美 日韩 国产精品免费观看| 久久在线视频在线| 蜜月aⅴ免费一区二区三区| 狂野欧美激情性xxxx| 久久婷婷国产麻豆91天堂| 久久综合中文| 欧美福利视频一区| 亚洲日韩欧美视频一区| 亚洲乱码视频| 亚洲一区二区免费视频| 午夜日韩在线| 久久久久欧美| 欧美成人一区二区在线 | 欧美一区二区三区男人的天堂| 性欧美xxxx大乳国产app| 欧美在线观看www| 久久青青草综合| 欧美激情综合在线| 国产精品久久久久久久久久免费| 国产精品免费看| 国内激情久久| 亚洲精选在线观看| 亚洲男人的天堂在线| 久久久蜜臀国产一区二区| 欧美大尺度在线观看| 亚洲免费观看视频| 小黄鸭视频精品导航| 免费在线看一区| 国产精品wwwwww| 玉米视频成人免费看| 一区二区国产日产| 久久黄色影院| 亚洲国产综合视频在线观看| 亚洲天天影视| 玖玖综合伊人| 国产精品久久久久久亚洲调教| 国产综合自拍| 亚洲一区二区黄色| 美腿丝袜亚洲色图| 亚洲一区二区欧美| 欧美aaa级| 国产综合自拍| 亚洲男同1069视频| 欧美激情精品久久久久久变态| 一区二区三区日韩在线观看| 久久精品视频免费| 国产精品久久久| 亚洲欧洲日产国产网站| 久久精品免费看| av成人免费在线| 免费亚洲电影在线| 国内一区二区在线视频观看| 亚洲图片欧洲图片日韩av| 欧美福利精品| 欧美在线欧美在线| 国产精品自拍在线| 午夜亚洲福利| 欧美午夜久久| 中文国产成人精品久久一| 欧美成人在线网站| 久久久久.com|