# DCP-466: Sanvi and TreeMap Back to All Problems

**Sanvi** is a very cute girl. She wants to travel different cities around the world. Recently, She has got a map with a list of cities where she is interested to visit including her current city. Different cities are numbered from **1** to **5**, which are: 1. Dhaka 2. Chittagong 3. Rajshahi 4. Kathmandu 5. Butwal And, Map looks like below: ![enter image description here][1] The above map's structure looks like [Tree data structure][2] in computer science. The node representing each city and edge representing connection between two cities and distance between them.<br> Currently Sanvi is staying in one of the above city and she wants to travel to any one of above city( destination city). Your task is to find the total distance she needs to travel to reach the destination city. Input: ------ Input starts with an integer **Q (1<=Q<=20)**, denoting the number of Quires.<br> Each query contains two city names separated by a space between them. City name will be exactly one of the above mentioned city. Output: ------- For each query output the total distance she needs to travel in a single line. Sample Input ------------ 2 Dhaka Butwal Kathmandu Dhaka Sample Output ------------- 8200 3200 [1]: https://s3-ap-southeast-1.amazonaws.com/devskillimagestorage/questionimages/7a6e9cdf-6a59-cb00-1c52-08d54e9de865_a9974d6bf167466ebbea7c7f8321024f_W416xH307.png [2]: https://en.wikipedia.org/wiki/Tree_%28data_structure%29

### Problem Limits

 Language Time Limit (seconds) C 1.00 C++ 1.00 C++14 1.00 C# 2.00 Go 2.00 Java 2.00 JavaScript 2.00 Objective-C 2.00 Perl 2.00 PHP 2.00 Python 2.00 Python3 2.00 Ruby 2.00 VB.Net 2.00

# 164/316

Solve/Submission

### Ranking

# User Language Timing
01 subhashis_cse Cpp 0.00s
02 prodipdatta7 Cpp 0.00s
03 DynamicOvi Cpp 0.00s
04 SakibAlamin Cpp 0.00s
05 inam Cpp14 0.00s
06 haasib Cpp 0.00s
07 st3inum Cpp 0.00s
08 mobasshir Cpp14 0.00s
09 Islam_Rafat Cpp14 0.00s
10 Shahriyar_Shovon Cpp 0.00s
11 Rasel_cse C 0.00s
12 sparrow C 0.00s
13 Jisancse Cpp14 0.00s
14 Taran Cpp14 0.00s
15 rayhan50001 Cpp 0.00s
16 by_default Cpp 0.00s
19 QuwsarOhi Cpp14 0.00s
20 anik_JU Cpp 0.00s
21 _GhOstMan_ Cpp 0.00s
22 nasib_mbstu Cpp 0.00s
23 Hasnaine Cpp 0.00s
24 yasirnabil534 Cpp 0.00s
25 The_Viper Cpp 0.00s
26 Nuwaisir Cpp 0.00s
27 tanu_1603070 Cpp 0.00s
28 Ahb_arif Cpp 0.00s
29 mh755628 Cpp 0.00s
30 Satkhira Cpp 0.00s
31 AlaminJust Cpp 0.00s
32 MRITuhin Cpp 0.00s
33 soohotiam Cpp 0.00s
34 jim_khan Cpp 0.00s
35 Zayed Cpp 0.00s
36 prottoy919 Cpp 0.00s
37 Tanmoy Cpp 0.00s
38 shamimjucse Cpp 0.00s
39 JubayerSohel Cpp14 0.00s
40 Dhrubo020 Cpp 0.00s
41 Tufahel Cpp 0.00s
42 IIUC_minhazmiraz Cpp14 0.00s
43 Durbin Cpp14 0.00s
44 Rajan_sust Cpp14 0.00s
45 motaleb_ICT Cpp 0.00s