above, Polycarp might have made the accompanying voyages (not every conceivable choice):    2→5→1→2→5;    3→6→2;    1→3→6→2→5.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Correct answer will be upvoted else Multiple Downvoted. Computer science.

 

 

above, Polycarp might have made the accompanying voyages (not every conceivable choice): 

 

2→5→1→2→5; 

 

3→6→2; 

 

1→3→6→2→5. 

 

Polycarp needs for each beginning city I to discover how close he can get to the capital. All the more officially: he needs to track down the insignificant worth of dj that Polycarp can get from the city I to the city j as indicated by the standards portrayed previously. 

 

Input 

 

The primary line contains one integer t (1≤t≤104) — the number of experiments. Then, at that point, t experiments follow. 

 

Each experiment is gone before by a vacant line. 

 

The main line of each experiment contains two integers n (2≤n≤2⋅105) and m (1≤m≤2⋅105) — number of urban areas and streets, individually. 

 

This is trailed by m lines portraying the streets. Every street is characterized by two integers u and v (1≤u,v≤n,u≠v) — the numbers of urban areas associated by a single direction street. 

 

It is ensured that the amounts of n and m over all experiments don't surpass 2⋅105. 

 

It is ensured that for each pair of various urban areas (u,v) there is all things considered one street from u to v (however a couple of streets from u to v and from v to u — is substantial). 

 

It is ensured that there is a way from the funding to all urban communities. 

 

Output 

 

For each experiment, on a different line output n numbers, the I-th of which is equivalent to the base conceivable separation from the money to the city where Polycarp finished his excursion.

 

 

 

 

 

Expert Solution
steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Structured English
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education