Problem I. 340. (February 2014)
I. 340. A group of friends had an online meeting in a closed chat room during a weekend afternoon. The chat room was opened at 13:00, and each conversation took place between two people, but a member could simultaneously participate in more conversations. The list of participants was stored in the chat program in advance. Then, after the room opened and for each conversation, the name of the person initiating the conversation, their partner's name, and the time when the conversation started and ended were recorded. These data can be downloaded from our web page and found in the file cseveges.txt.
The first line of the file contains the number of participants N (2N20). The next N lines contain the list of participants (individual names do not contain space characters). The following line contains the number of conversations M (2M1000). Then each of the following M lines contains two numbers (BE, BV) and two names (B1, B2). The first number, BE (0BE720) describes the number of minutes from the room opening until the start of the actual conversation, while the second number, BV (BEBV720) is the number of minutes from the room opening until the end of the conversation. The first name (B1) is the name of the person initiating the conversation, and B2 is the partner's name.
Your program i340 should solve the following tasks.
The number of the actual task (e.g., Task #3:) should be displayed before the result whenever there is output to the screen. If user input is expected, a message briefly describing the input should also be displayed first (e.g., Enter the name of participants:). Diacritical marks in the output may be omitted.
1. Load and store the data from the file cseveges.txt in a form suitable to solve the following tasks.
2. Display on the screen the average duration of the conversations rounded to 2 decimal digits of precision.
3. Prompt the user to enter the name of a participant, then display his or her total conversation time.
4. Count the number of occurrences of the event that a person called a friend, and after the conversation was over, the original caller again initiated a conversation with the same friend but without chatting to anyone else in the meantime.
5. Collect and display on the screen all the people who did not make any conversation.
6. Display the starting and ending time of the longest interval during which no conversation occurred.
7. For each hour after the opening of the chat room, determine the number of different people having a conversation during that hour. (A conversation can belong to several such blocks of length of 1 hour.)
8. Determine the time instant (or a time instant, if there were more) when the number of participants in different conversations was maximal.
9. List the people having the longest conversation with each other.
The source code (i340.pas, i340.cpp, ...) of your program and its brief documentation (i340.txt, i340.pdf, ...) should be submitted, also specifying the name of the developer environment to use for compiling your source.
Downloadable file: cseveges.txt
Deadline expired on 10 March 2014.
Sorry, the solution is available only in Hungarian. Google translation
Paulovics Zoltán 11. osztályos tanuló (Zrínyi Miklós Gimnázium, Zalaegerszeg) megoldása: i340.vb