Garlic: garlic (shortest way) with a passion for work

Source: Internet
Author: User
Tags time limit

Topic links Love working garlic and garlic

Time limit:1000ms Memory limit:262144k

problem Description

As we all know, garlic is a good job-loving staff, he thinks time is money, do things always race against the clock.

This evening, garlic and garlic went to dinner alone. Unfortunately, after dinner, it began to rain, garlic and garlic did not bring an umbrella out. But garlic and garlic love work, work makes him happy, he wants to hurry back to write code.

Garlic Company in Zhongguancun, Zhongguancun side of the complex topography, there are many bridges, underground passages and the road staggered together. Among them, underground passages can be sheltered from the rain, flyovers and roads are not able to avoid. Zhongguancun can be abstracted into a map of n points (vertex number 1 to n), which has M1 m_1 underground passage, there are M2 M_2 road or overpass, of which the length of the underground channel is 1. Garlic eating place at 1 O ', company at N Point. Of course, although garlic and garlic love work, but he does not want to rain a lot, but also do not want to waste a lot of time. So he had a compromise-he wanted to be in the rain and as little as possible in the case that the sum of the journeys he had taken back to the company was less than or equal to L.

Please help yourself to a job-loving garlic. Plan A path, don't let him waste time. Input

The first line enters the number of test groups T (1≤T≤20). The first line enters the number of test groups T (1 \le T \le 20).

Next T Group data. Next T Group data.

The first line of each set of data is entered in four integers n (2≤n≤100), M1 (0≤m1≤50), M2 (0≤m2≤5000), L (1≤l≤108). The first line of each set of data is entered in four integers n (2 \le n \le), m_1 (0 \le m_1 \le), m_2 (0 \le m_2 \le), L (1 \le L \le 10^8).

Next to the M1 line, enter two integers a, B (1≤a,b≤n) per line, indicating that A and B have a

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.