In the TV series "The Secret of Santa Barbara", 20 characters are involved. In each episode, one of the following events occurs: a certain character learns the Secret, a certain character learns that someone knows the Secret, a certain character learns that someone does not know the Secret. What is the maximum number of episodes the series can last?
Calculate the maximum number of times each of the three types of events specified in the condition can occur.

## Solution

Each hero can learn something in no more than 39 episodes (one episode to learn the Secret, 19 episodes to learn that each of the others does not know the Secret, and another 19 episodes to learn that each of the others knows the Secret). Therefore, the number of episodes is no more than $20 \cdot 39=780$.

Let's construct an example of a series with 780 episodes. Initially, no one knows the Secret. In the first 380 episodes, for each ordered pair of heroes, the first one learns that the second does not know the Secret. In the next 20 episodes, all heroes sequentially learn the Secret. In the last 380 episodes, for each ordered pair of heroes, the first one learns that the second knows the Secret.

## Answer

780 episodes.