• <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>

            Farm Tour poj 2135 最小費用流

            Posted on 2012-05-01 16:37 lenohoo 閱讀(97) 評論(0)  編輯 收藏 引用
            Farm Tour

            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


            MCF

            posts - 3, comments - 1, trackbacks - 0, articles - 16

            Copyright © lenohoo

            精品国产乱码久久久久久呢 | 91精品国产91久久久久久蜜臀| 亚洲午夜久久久久久噜噜噜| 久久久久99精品成人片欧美| 精品国产热久久久福利| 2021国内久久精品| 久久综合久久综合久久| 久久这里都是精品| 久久亚洲国产中v天仙www| 久久久久久久久66精品片| 婷婷综合久久中文字幕| 国产成人精品三上悠亚久久| 91性高湖久久久久| 久久夜色精品国产欧美乱| 色综合久久夜色精品国产| 国产成人久久777777| 亚洲精品无码久久久影院相关影片 | 久久国语露脸国产精品电影| 欧美日韩中文字幕久久伊人| 亚洲精品国产美女久久久| 久久婷婷是五月综合色狠狠| 99久久亚洲综合精品成人| 久久久老熟女一区二区三区| 狠狠色噜噜色狠狠狠综合久久| 久久国产精品视频| 久久综合九色综合久99 | 久久久久亚洲AV成人网| 久久免费精品一区二区| 国产综合久久久久| 久久久久久亚洲AV无码专区| 亚洲综合伊人久久大杳蕉| 99热热久久这里只有精品68| 色综合久久久久综合体桃花网| 亚洲国产成人久久综合区| 久久久久噜噜噜亚洲熟女综合| 大香网伊人久久综合网2020| 国产999精品久久久久久| 色综合合久久天天给综看| 精品久久久久中文字幕一区| 久久精品国产亚洲Aⅴ蜜臀色欲| 狠狠综合久久综合中文88|