Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The first line in the input contains a single integer T, indicating the number of test cases ( 1T20 ) Each test case begins with

image text in transcribed

The first line in the input contains a single integer T, indicating the number of test cases ( 1T20 ) Each test case begins with five integers A, B, M, L and K - the number of Villages, the number of Castles (1A,B50), the number of roads, the maximal distance that can be covered at a time (1L500), and the number of times the boot can be used (0K10). The next M lines each contains three integers Xi,Yi, Li. That means there is a road connecting place Xi and Yi . The distance is Li, so the walk time is also Li(1Li100). Output For each test case in the input print a line containing a single integer indicating the minimal time needed to go home with the beautiful princess. It's guaranteed that Super Mario can always go home. Sample Input 1 42691 461 5610 455 354 234 123 Sample Output 9 interpret the input and explain how we get output=9 . explain line by line according to input

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions

Question

At birth, Raj weighed 7 lbs. 13 oz. What is this in ounces? ounces

Answered: 1 week ago

Question

What are the differences between dismissal and discharge?

Answered: 1 week ago