# Task 3. Maximum 16 points

The results of trading in the shares of companies "a", "b", "c", "d", "e" were predicted by two financial analysis gurus. Trying to predict the results of the day's trading, one of the analysts calculated that the share prices at the end of the day would be ranked in descending order as "a", "b", "c", "d", "e". However, it turned out that he did not guess the ranking position of any share, nor the direct sequential order of any pair of participants in the ranking. The other analyst ranked the share prices in ascending order, predicting the result as "b", "c", "e", "a", "d", and correctly identified the ranking positions of two shares, as well as the exact ranking order for two pairs of consecutive shares (for example, the pair "b" and "c", or "c" and "e", etc.) What was the actual result of the trading?
# Solution:

Consider the second guru's prediction.

Obviously, if a correctly indicated pair includes one correctly indicated element, then the other element of the pair is also correctly indicated.

The sequence "d", "a", "e", "s", "b" (let's write the result of the second guru in descending order) contains four pairs: da, ae, es, sb. Two of these pairs are guessed correctly. Suppose these two pairs share a common letter (dae, aes, esb). Then a triplet is formed, in which the order is correctly guessed. How do we determine the two correctly guessed positions of the letters? If at least one such letter is in the triplet, then the entire triplet consists of correctly guessed positions of the letters, which cannot be the case since there are only two such letters. If both letters are outside the triplet, then all 5 letters are in their correct positions, which is even more inconsistent with the conditions.

Thus, out of the four pairs, we need to choose two that do not share a common letter. Clearly, this can be done in three ways: (da, es); (da, cb); (ae, cb). In each of these ways, one of the two pairs must contain correctly guessed letters, while the other contains incorrectly guessed ones. Considering our three cases, we see that in the first and third cases, only one sequence is possible, while in the second case, two sequences are possible. We get 4 sequences: dabec - the first way; edacb and dacbe the second way; aess - the third way.

Considering these 4 sequences from the perspective of the first guru, we see that only one satisfies the conditions: edacb.

## Evaluation Criteria: