HDU 5441 Travel Sort and check set

Source: Internet
Author: User

Travel Time limit:1500/1000 MS (java/others) Memory limit:131072/131072 K (java/others)
Total submission (s): 2149 Accepted Submission (s): 740


Problem Description Jack likes to travel around the world, but he doesn ' t like to wait. Now, he's traveling in the Undirected kingdom. There is n cities and m bidirectional roads connecting the cities. Jack hates waiting too long on the bus, but he can rest at every city. Jack can only stand staying on the bus for a limited time and would go berserk after.  Assuming know the time it takes to go from one city to another and that the time Jack can stand staying on a bus is X Minutes, how many pairs of the city (A, a, a, b) is there that Jack can travel from city A to B. without going berserk?
Input The first line contains one integer t,t≤5, which represents the number in test case.

For each test case, the first line consists of three integers n,m and q where n≤20000,m≤100000,q≤5000. The undirected kingdom has n cities and Mbidirectional roads, and there is Q queries.

Each of the following m lines consists of three integers a, B and D where A,b∈{1,..., n} and d≤100000. It takes Jack D minutes to the

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.