• <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
            本題題意大概是最小費(fèi)用流!
            在處理的時(shí)候要處理重邊。。。。。其實(shí)我們可以證明的,就是如果存在重邊我們最多只需要記錄兩個(gè)邊就可以解題!
            以最大流最小費(fèi)用流原理我們知道,消負(fù)權(quán)最后達(dá)到的效果就是最大流的情況下不存在流經(jīng)兩次的邊。。。。。即每條邊最多只能流經(jīng)一次,由此可知我們可以最多儲(chǔ)存兩條重邊!
            AC 了 79ms很慢
            posted on 2009-03-17 19:40 KNIGHT 閱讀(227) 評(píng)論(0)  編輯 收藏 引用

            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            <2009年3月>
            22232425262728
            1234567
            891011121314
            15161718192021
            22232425262728
            2930311234

            常用鏈接

            留言簿(8)

            隨筆檔案

            文章檔案

            Friends

            OJ

            搜索

            •  

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            久久久久久亚洲精品成人| 色综合久久夜色精品国产| 久久免费美女视频| 久久久久亚洲精品天堂久久久久久| 一本色道久久综合狠狠躁篇| 亚洲成色WWW久久网站| 97精品国产97久久久久久免费| 久久精品国产2020| 91亚洲国产成人久久精品| 无码人妻久久一区二区三区免费丨| 天天综合久久久网| 日韩乱码人妻无码中文字幕久久 | 18禁黄久久久AAA片| 久久人人爽人人爽人人片AV不| 成人亚洲欧美久久久久| 久久久久亚洲av无码专区导航| 久久人人爽人人爽人人片AV东京热| 久久精品国产第一区二区三区| 亚洲人成无码www久久久| 99久久精品无码一区二区毛片| 久久亚洲精品无码AV红樱桃| 无码八A片人妻少妇久久| 久久久99精品成人片中文字幕| 2021精品国产综合久久| 久久综合给合久久国产免费| 国产69精品久久久久APP下载| 久久综合九色综合欧美就去吻| 国产 亚洲 欧美 另类 久久| 久久99国产精品二区不卡| 蜜臀av性久久久久蜜臀aⅴ| 精品久久人人爽天天玩人人妻| 久久亚洲精品无码观看不卡| 久久天天躁狠狠躁夜夜2020老熟妇| 99久久国产免费福利| 久久精品成人欧美大片| 久久精品国产亚洲5555| 久久精品女人天堂AV麻| 伊人精品久久久久7777| 久久久久久久久久久久久久| 伊人久久精品无码av一区| 久久久久亚洲AV无码网站|