• <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成人网人人网站 | 狠狠色噜噜狠狠狠狠狠色综合久久 | 精品国产青草久久久久福利| 久久99精品九九九久久婷婷| 一级做a爰片久久毛片看看| 国产亚洲精品久久久久秋霞 | 亚洲日本va中文字幕久久| 久久精品国产亚洲AV嫖农村妇女| 国内精品久久久久影院优 | 亚洲欧美精品伊人久久| 欧美成a人片免费看久久| 无遮挡粉嫩小泬久久久久久久| 日韩一区二区久久久久久| 热久久最新网站获取| 久久99精品久久久久久不卡 | 一本一道久久精品综合| 国产aⅴ激情无码久久| 久久国产高清一区二区三区| 狠狠色婷婷久久一区二区三区| 综合久久给合久久狠狠狠97色 | 久久国产亚洲高清观看| 久久综合鬼色88久久精品综合自在自线噜噜 | 日韩欧美亚洲国产精品字幕久久久 | 国产成人无码精品久久久性色| 国产精品成人精品久久久| 99久久成人国产精品免费| 性做久久久久久久| 精品综合久久久久久98| 久久亚洲中文字幕精品一区四| 四虎国产精品免费久久5151| 俺来也俺去啦久久综合网| 亚洲伊人久久精品影院| 久久精品亚洲AV久久久无码| 无码任你躁久久久久久| 青青久久精品国产免费看| 久久青青国产| 中文字幕无码久久精品青草| 2021国内精品久久久久久影院| 亚洲另类欧美综合久久图片区| 亚洲国产成人久久一区WWW| 日本WV一本一道久久香蕉|