Task 4

Login required

26. 10. 2023 18:00 | You can get 4 points for the task

Tourist Rescue Net

Rural Charmington was a small town surrounded by lush, untamed forests and crisscrossed with a network of hiking trails, connecting interesting and tourist-friendly spots that earned the town the nickname "Nature's Playground." Tourists flocked to Charmington year-round, drawn by the promise of fresh air, unspoiled wilderness, and the chance to explore the scenic beauty the town had to offer.

As the city grew in popularity, so did the number of people roaming the sidewalks. With this increase in tourists, there were also increasing cases where tourists got lost and got stuck in one of the places, or in case of injury, they could not return from a popular place back to the city. Despite their beauty, the forests were vast and thus could be disorienting even for experienced tourists.

Local rescue team was doing their best to ensure the safety of the tourists. They were well trained, equipped and had a good understanding of the route network. However, a specific incident created a need to improve their skills.

One calm afternoon, as the sun bathed the forest in a golden glow, a cry for help echoed through the hills. A family of hikers ventured into the woods for a hike, only to find themselves disoriented and lost after dark. The family panicked when they realized they didn't know how to find their way back to safety, so they didn't hesitate to call the rescue team immediately.

The family only knew that they were at one of the touristic points, but they could not describe which tourist spot they were at. Therefore, it was necessary for the rescue teams to explore as many nodes as possible, where the family could be located.

In order to ensure a quick rescue and to avoid wasting valuable time by backing up or using inefficient routes, it was crucial to plan the route so that each node of the tourist sites was visited by rescuers only once.

The rescue team planned the routes with determination and precision to visit most places in the park and not to visit each place more than once, and it took them long hours.

Finally, the local rescue team was ready and sprung into action. The rescue team set out on a journey through a network of trails, determined to bring the lost family back to safety. Their journey was a testament to their skill and dedication as they traversed winding paths, climbed steep slopes and traversed thick undergrowth.

Hours later, they reached the lost family, tired but relieved. The family was safe and the town cheered the incredible work of the rescue team.

This experience was a turning point for Charmington. He emphasized the critical importance of wayfinding through the trail network for safety and rescue operations. She underscored the value of preparation, knowledge and especialy faster planning.



Your task now is, like the rescue team, to find a route in the network of nodes so that you visit as many nodes as possible, but each one at most once. You can start in any point.

A network is described by a pair of nodes that are connected to each other. You can go in both directions on the path.

Type into the output:

• Number of visited nodes in the path (1 point)

• Write a route in the form of pairs of nodes (2 points)

• Connect the source code to the output. (1 point)





{1,3}, {1,4), {2,1}, {3,5}


Number of nodes in path: 4

{4,1}, {1,3}, {3,5}

My Cod77