[Codevs 1183] [muddy roads (Binary + spfa)

Source: Internet
Author: User

Title: http://dev.codevs.cn/problem/1183/

Analysis: This is very similar to the optimal rate spanning tree, which can be divided into two answers, except that the first is to determine whether there is a shortest path, and the other is to determine whether a tree is generated. Assume that ANS is to be determined, we can change the edge weight of each edge to s [I] [J]-ans * t [I] [J], then run the longest path. If d [N]> = 0, it indicates that this ANS is feasible. However, you must note that the right ring may appear during the longest possible path, so you can make up the following, whether or not the ring contains N, but they can all go through this ring several times, which makes the current d very big, so that when taking some negative side to N, the total d [N] is greater than or equal to 0, so when there is a right ring, we can think that this ANS is feasible.

[Codevs 1183] [muddy roads (Binary + spfa)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.