• <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>
            posts - 74,  comments - 33,  trackbacks - 0
            Farm Tour
            Time Limit: 1000MS Memory Limit: 65536K
            Total Submissions: 1152 Accepted: 351

            Description

            When FJ's friends visit him on the farm, he likes to show them around. His farm comprises N (1 <= N <= 1000) fields numbered 1..N, the first of which contains his house and the Nth of which contains the big barn. A total M (1 <= M <= 10000) paths that connect the fields in various ways. Each path connects two different fields and has a nonzero length smaller than 35,000.

            To show off his farm in the best way, he walks a tour that starts at his house, potentially travels through some fields, and ends at the barn. Later, he returns (potentially through some fields) back to his house again.

            He wants his tour to be as short as possible, however he doesn't want to walk on any given path more than once. Calculate the shortest tour possible. FJ is sure that some tour exists for any given farm.

            Input

            * Line 1: Two space-separated integers: N and M.

            * Lines 2..M+1: Three space-separated integers that define a path: The starting field, the end field, and the path's length.

            Output

            A single line containing the length of the shortest tour.

            Sample Input

            4 5
            1 2 1
            2 3 1
            3 4 1
            1 3 2
            2 4 2

            Sample Output

            6
            

            Source

            USACO 2003 February Green
            本題題意大概是最小費用流!
            在處理的時候要處理重邊。。。。。其實我們可以證明的,就是如果存在重邊我們最多只需要記錄兩個邊就可以解題!
            以最大流最小費用流原理我們知道,消負權最后達到的效果就是最大流的情況下不存在流經兩次的邊。。。。。即每條邊最多只能流經一次,由此可知我們可以最多儲存兩條重邊!
            AC 了 79ms很慢
            posted on 2009-03-17 19:40 KNIGHT 閱讀(222) 評論(0)  編輯 收藏 引用
            <2009年3月>
            22232425262728
            1234567
            891011121314
            15161718192021
            22232425262728
            2930311234

            常用鏈接

            留言簿(8)

            隨筆檔案

            文章檔案

            Friends

            OJ

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            97精品国产97久久久久久免费| 久久精品国产网红主播| 久久综合五月丁香久久激情| 亚洲国产日韩欧美综合久久| 亚洲午夜久久久影院伊人| 国产精品一区二区久久国产| 99久久精品国产综合一区| 亚洲天堂久久久| 久久精品中文字幕久久| 无码乱码观看精品久久| 韩国免费A级毛片久久| 一本久久精品一区二区| 久久国产精品-国产精品| 色青青草原桃花久久综合| 久久99精品国产99久久6男男| 久久中文字幕人妻熟av女| 久久青草国产精品一区| 亚洲精品无码久久久久去q | 伊人久久大香线蕉av不卡| 久久国产精品一国产精品金尊 | 成人妇女免费播放久久久| 精品一久久香蕉国产线看播放| 无码久久精品国产亚洲Av影片| 久久93精品国产91久久综合| 大伊人青草狠狠久久| 亚洲∧v久久久无码精品| 亚洲国产精品无码久久青草| 久久精品国内一区二区三区| 欧美黑人又粗又大久久久| 久久亚洲精品无码aⅴ大香 | 国产精品久久久久久一区二区三区| 久久精品国产色蜜蜜麻豆| 一级做a爰片久久毛片看看| 久久最新免费视频| 久久久久亚洲AV成人网人人软件| 成人精品一区二区久久| 99久久国产免费福利| 国产精品99久久久久久董美香| 国产福利电影一区二区三区久久老子无码午夜伦不 | 亚洲国产欧洲综合997久久| 亚洲午夜久久久影院伊人|