• <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年1月>
            28293031123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567

            常用鏈接

            留言簿(8)

            隨筆檔案

            文章檔案

            Friends

            OJ

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            日韩精品久久无码人妻中文字幕 | 伊人久久精品无码二区麻豆| 久久综合精品国产一区二区三区| 久久国产影院| 无码人妻精品一区二区三区久久| 久久精品中文闷骚内射| 国产精品美女久久久久AV福利| 欧美久久久久久| 国产精品久久久久国产A级| 久久www免费人成精品香蕉| 综合人妻久久一区二区精品| 青青热久久综合网伊人| 2019久久久高清456| 国产L精品国产亚洲区久久| 99久久精品国产一区二区 | 日韩亚洲欧美久久久www综合网| 久久精品亚洲精品国产欧美| 久久人爽人人爽人人片AV| 久久影院久久香蕉国产线看观看| 亚洲狠狠婷婷综合久久久久| 精品久久久久久无码中文字幕| 久久99精品久久久久久久不卡| 2021国产精品久久精品| 久久精品视屏| 久久精品国产精品亜洲毛片| 久久精品国产亚洲AV无码娇色| 久久青青草原精品国产不卡| 国产综合精品久久亚洲| 91久久精品国产成人久久| 91精品国产色综合久久| 久久天天躁狠狠躁夜夜avapp| 亚洲精品乱码久久久久66| 国产精品美女久久福利网站| 久久精品国产精品亚洲| 久久久久亚洲?V成人无码| 国产成人精品久久亚洲高清不卡 国产成人精品久久亚洲高清不卡 国产成人精品久久亚洲 | 精品一二三区久久aaa片| 亚洲另类欧美综合久久图片区| 欧美午夜A∨大片久久| 久久婷婷五月综合成人D啪| 青青青青久久精品国产h久久精品五福影院1421 |