Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ programming (very urgent pls) 3. Cinemas There are N cinemas in Budapest (numbered from 1 to N) and for each of them we know

C++ programming
(very urgent pls)
image text in transcribed
image text in transcribed
3. Cinemas There are N cinemas in Budapest (numbered from 1 to N) and for each of them we know which movies it showed last night. The data are given with paits: title of a movie and a cinema identifier, meaning that the movie was shown by that cinema. Write a program that determines the following 1. A movie that was shown by a given cinema (with identifier K). 2 A cinema that did not show any movies last night. The count and the list of different movies that were shown by at least one cinema. 4. The cinema that showed the most movies 5. Two cinemas which showed the same set of movies. Input The first line of the standard input contains the number of cinemas (15NS1000), the number of data pairs (1SMS2000), and a cinema identifier (15KSN). In the next M*2 lines, there is a data pair in every two lines: the title of a movie, and the identifier number of a cinema wirich showed that movie (15C:SN). For simplicity, the titles are written in one word with at most 10 letters of the English alphabet. A cinema showed at most 10 movies, and the number of different movies does not exceed 1000. There are no duplicate data entries (a cinema did not show a movie multiple times) Output The standard output should contain a line with a single #character before the solution of cach 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/mote #characters are in the output), you will get "Output format error", even if you have correct solutions for some subtasks. Subtask 1 (20 points): Print the title of a movie that was shown by the cinema K, on a single line. If there is no such movie, print the word NONE. If there are more than one such movies, print the one that appears first in the input. Subtask 2 (20 points): A single line should contain the identifier number of a cinema that did not show any movies. In case of multiple possible answers, print the smallest such identifier. If every cinema showed at least one movie, print 0. Subtask 3 (20 points): In the first line, print the number of different movies that appear in the input. Then print the titles of these movies on separate lines in any order). Every movie should appear only once in the list. Subtask 4 (20 points): Print the identifier of the cinema that showed the most movies. In case of multiple possible solutions, you must give the one with the smallest identifier. Subtask 5 (20 points): Print two numbers in any order) separated by a space, the identifiers of two cinemas, which showed the same set of movies. If there are multiple possible solutions, give the pair of cinemas that showed the most movies 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 cinemas, print 00. (Note: both cinemas must have shown at least one movie, i. c. a pair of cinemas which did not show any movies does not count as a solution.) See the example on the next page. Example Input 4 6 2 Shrek 1 Inception 2 DieHard 6 1 Shrek 3 Shrek 4 DieHard6 2 Output # Inception # 0 # 3 Shrek Inception DieHard6 # 1 # 3 4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions