Cartoons There are N television channels available in Hungary (numbered from 1 to N) and for each of them we know which cartoons it showed this morning. The data are given with pairs: title of a...


I need step by step code with comment s


.




Cartoons<br>There are N television channels available in Hungary (numbered from 1 to N) and for each of them<br>we know which cartoons it showed this morning. The data are given with pairs: title of a cartoon<br>and a channel identifier, meaning that the cartoon was shown by that channel.<br>Write a program that determines the following:<br>1.<br>The number of cartoons that were shown by a given channel (with identifier K).<br>2.<br>The count and list of channels that showed the cartoon which appears first in the input.<br>3.<br>The number of different channels that showed at least one cartoon.<br>4.<br>The cartoon in the input which was shown by the least channels.<br>5.<br>Two cartoons that were shown by the same number of channels.<br>Input<br>The first line of the standard input contains the number of channels (1SNS1000), the<br>number of data pairs (1SMS2000), and a channel identifier (1SKSN). In the next M*2 lines, there<br>is a data pair in every two lines: the identifier number of a channel (1SE,SN), and the title of a<br>cartoon which was shown by that channel. For simplicity, the titles are written in one word with at<br>most 10 letters of the English alphabet. A channel showed at most 10 cartoons, and the number<br>of different cartoons does not exceed 1000. There are no duplicate data entries (a channel cannot<br>show a cartoon multiple times).<br>Output<br>The standard output should contain a line with a single # character before the solution of<br>each subtask. This # character line is followed by as many lines as needed for the output of a<br>subtask. If you cannot solve a subtask, you should output only the line containing the # character.<br>If the output format is not correct (less/more # characters are in the output), you will get

Extracted text: Cartoons There are N television channels available in Hungary (numbered from 1 to N) and for each of them we know which cartoons it showed this morning. The data are given with pairs: title of a cartoon and a channel identifier, meaning that the cartoon was shown by that channel. Write a program that determines the following: 1. The number of cartoons that were shown by a given channel (with identifier K). 2. The count and list of channels that showed the cartoon which appears first in the input. 3. The number of different channels that showed at least one cartoon. 4. The cartoon in the input which was shown by the least channels. 5. Two cartoons that were shown by the same number of channels. Input The first line of the standard input contains the number of channels (1SNS1000), the number of data pairs (1SMS2000), and a channel identifier (1SKSN). In the next M*2 lines, there is a data pair in every two lines: the identifier number of a channel (1SE,SN), and the title of a cartoon which was shown by that channel. For simplicity, the titles are written in one word with at most 10 letters of the English alphabet. A channel showed at most 10 cartoons, and the number of different cartoons does not exceed 1000. There are no duplicate data entries (a channel cannot show a cartoon multiple times). Output The standard output should contain a line with a single # character before the solution of each subtask. This # character line is followed by as many lines as needed for the output of a subtask. If you cannot solve a subtask, you should output only the line containing the # character. If the output format is not correct (less/more # characters are in the output), you will get "Output format error" even if you have correct solutions for some subtasks. Subtask 2unit éoints): Print the number of cartoons which were shown by the channel K. Subtask 2k pupints): The first line should contain the count of channels which showed the the first data pair. The second line should contain the list of the identifiers of cartoon thaon these channels, in the same order as they appear in the input with that cartoon. Subtask - thn oints): Print a single number, the count of different channels that showed at least one cartoenis Subtask thoints): Print the cartoon that was shown by the least number of channels. In case of multiple Bossible solutions, you must give the cartoon that is the first in their alphabetical order. Subtask he ary coints): Print two cartoons (in any order) separated by a space, which were shown by the sanfbe sanber of channels. If there are multiple possible solutions, give the pair of cartoons with the most channels (among these pairs), and if there are still more than one possibilities, you can print any of them. If there is no such pair of cartoons, print 0 0. See the example on the next page.

Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here