Zadania úloh

Task 1

Buggy – Master Password Manager

 

This is an almost real story about a programmer Buggy who works for a successful IT company.

 

When one day Buggy decided to change his passwords, he made three mistakes when entering the new password into the security program and thus blocked his account.

 

To unlock his account, he needed to know his strongest password, the master password. But it was such a long string of characters that it was impossible to remember. Moreover, it was a password that he did not have to enter anywhere in practice to unblock his account. Since he didn't remember it, he had a trick for this situation. He prepared his own algorithm to obtain the password. But he had to program it first to get to the final password, because he was never a fan of keeping such information in the classic format.

 

He used a matrix of characters, where each character had its own coordinate in the matrix. The matrix of characters was 8x8 in size and contained the numbers from 0 to 9, followed by the alphabet with lowercase letters, then with uppercase letters, and finally the special characters comma and dot. The only thing that Buggy has physically preserved are the coordinates of the characters from which words could be composed, necessary for the subsequent compilation of his master password.

The coordinates consisted of row + column pairs, according to which it is possible to find the necessary characters in the matrix, which make up words separated by a comma.

Since breaking such encryption using coordinates is basically an easy task for anyone who has the matrix and the list of coordinates of the characters in the matrix, the resulting string did not represent his master password yet.

 

The string he got so far are just the words separated by commas. The trick that had to be done after decryption is to shorten the string by joining words. Combining words has its own rule: if the end of the first word contains the same characters as the beginning of the next word, then the next word must be shortened by these characters and the rest of the second word must be joined to the previous one. This step removes special character (commas or dot) at the same time. For example, when the first word is " data-cke-survive="1" data-cke-survive="1" data-cke-survive="1"lemON" followed by the word "onion", the result should be "lemONion". If adjacent words have no character crossing, nothing is removed except the special character between the words. Case does not matter when comparing characters, so "on" = "On" = "oN". If there is an overlap of the same characters, characters from the second word are always removed, not from the first.

 

When Buggy finally managed to get the final chain, the security system had 2 more control questions ready. He needed to answer a control question to enter the total number of characters that were removed after applying his algorithm (special characters such as dot and comma are not included in the count) and also to enter the longest string of characters that was removed (case-sensitive).

 

Since several years have passed since this event, Buggy has already said goodbye to a similar password storage and encryption strategy and moved on to more reliable methods. However, he is still interested in how many programmers would be able to guess his password, assuming they got the coordinates.

 

 

Therefore, the output of your task is:
• write down the password itself
• the number of characters that were removed after applying the algorithm (special characters such as dots and commas are not included in the number)
• and the longest string of characters that was removed (case-sensitive)
• at the end, attach the code that you used to create the password

 

 

Example:
Input file:
{{1,2},{3,1},{3,1},{2,5},{1,6},{7,6},{2,5},{1,6},{ 2,6},{3,0},{2,7},{7,6},{3,0},{2,7},{2,2},{3,0},{2, 7}};

Matrix:
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,.";

 

Inter result:
"apple, lemon, onion"
(Counting starts with 0. Position {1,2} means 2. row and 3. column.)

 

 

Output:
Password: "applemonion"
Deleted strigs: "leon"
The longest deleted string: "le"

 

TXT FILE FOR DOWNLOAD

 

SOLUTION HERE

 

Task 2

A fairy tale


One night, a fairy flew to little Ann and told her this bedtime story - the 'TEXT' of the fairy tale is HERE


Question:
In their magical land, the fairies' language is encrypted with a password, can you decipher it and find out the name of the fairy tale that the fairy told little Ann? The text and the fairy tale are in English.

 

Send us the name of the fairy (1 point).
At the end attach the source code of your program (1 point).

SOLUTION HERE

 

Task 3

Stringeria

Once upon a time, in a mystical land known as Stringeria, there lived two remarkable siblings, Stringelia and Stringarion. These siblings were not ordinary at all, they were able to create a magical connection with letters in words. Both of the siblings were gifted with the art of crafting beautiful strings, each composed of letters that danced like fireflies on a warm summer night. As the siblings grew, their miraculous words began to differ slightly.

 

But one fateful day, a dark shadow fell upon Stringeria. A powerful curse, cast by an envious sorcerer, crept through the land, and the once thriving kingdom was plunged into turmoil. The curse shattered the kingdom into fragments, messed up its stories, its songs, and its history.

 

Break of the curse for the region was possible only thanks to the finding of the longest common sequence of magic strings created by Stringelia and Stringarion. Help us to save Stringeria and find sequence, which will break the curse.

 

Find the longest common subsequence in the strings s1 and s2, where characters don't need to follow each other directly.

  • Let the output be the given string
  • and the length of this sequence.
  • At the end attach the source code of your program.

TXT INPUT HERE

 

Example input:

s1 = "ABECF"

s2 = "AEEDC"

 

Example output:

"AEC"

3

6

SOLUTION HERE 

 

Task 4

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)

 

 

TXT INPUT HERE

 

Example
Input:
{1,3}, {1,4), {2,1}, {3,5}

 

Output:
Number of nodes in path: 4

Path:
{4,1}, {1,3}, {3,5}

My Cod77

SOLUTION HERE 

 

Task 5

Voyage to Mars

In the not-so-distant future, humanity has set its sights on the Red Planet, Mars. A team of ambitious space pioneers is preparing for the most significant journey in the history of space exploration - colonization of Mars. The countdown to launch has begun, and the rocket is scheduled to depart for Mars tomorrow. The mission is fraught with challenges, and the key to its success lies in optimizing the payload of the Mars-bound rocket, but there's no time to find the perfect solution.

 

To ensure the mission's success, a group of brilliant scientists has been assigned the last-minute task of selecting and prioritizing machines based on their usefulness. These machines come in various shapes and sizes, but they all serve vital functions in the colonization process. Some machines are responsible for resource extraction, while others are crucial for habitat construction, life support, and scientific research.

 

The scientists have carefully rated each machine for its usefulness, providing a numerical score to represent its importance. Additionally, they have assessed the size of each machine, which must be taken into account when loading the rocket. The rocket's payload capacity is limited, and every bit of space must be utilized efficiently to ensure that all necessary machines are sent to Mars.

 

The urgency is real, and time is running out. The scientists must develop a program that helps the colonization team make the most of the limited space in the rocket, and they don't have the luxury of finding the perfect solution. They need to design an algorithm that quickly selects the machines to be included in the payload, ensuring that the total usefulness is maximized without exceeding the rocket's size limit.

 

The science team is fully aware of the fact that finding perfect solution is not easy. Your challenge is to create an algorithm that operates under tight time constraints, selecting the machines for the rocket's payload as efficiently as possible.

 

Select machines to maximize usefulness while staying within the payload size limit.

JSON FILE WITH INPUT HERE

Input file:

{ "items": [

{ "id": ID0, "value": value0, "weight": weight0 },
{ "id": ID1, "value": value1, "weight": weight1 },
{ "id": ID2, "value": value2, "weight": weight2 },
],
"capacity": weight_limit }

 

Output:

Total value: total_value
Total weight: total_weight
items:
ID0
ID1

 

Example:
Input:
{
"items": [
{ "id": 0, "value": 26, "weight": 5 },
{ "id": 1, "value": 36, "weight": 10 },
{ "id": 2, "value": 41, "weight": 14 }
],
"capacity": 20
}

 

Output:
Total value: 67
Total weight: 19
items:
0
2

SOLUTION HERE