Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Submissions Problem description You are organizing a Hash Code hub and want to order pizza for your hub's participants. Luckily, there is a nearby pizzeria
Submissions Problem description You are organizing a Hash Code hub and want to order pizza for your hub's participants. Luckily, there is a nearby pizzeria with really good pizza. The pizzeria has different types of pizza, and to keep the food offering for your hub interesting, you can only order at most one pizza of each type. Fortunately, there are many types of pizza to choose from! File format The output should contain two lines The first line should contain a single integer K (OSKN) - the number of different types of pizza to order. The second line should contain K numbers - the types of pizza to order the types of pizza are numbered from 0 to N-1 in the order they are listed in the input) Each type of pizza has a specified size: the size is the number of slices in a pizza of this type. The total number of slices in the ordered pizzas must be less than or equal to M You estimated the maximum number of pizza slices that you want to order for your hub based on the number of registered participants. In order to reduce food waste, your goal is to order as many pizza slices as possible, but not more than the maximum number. Example Submission file 3 Description 3 types of pizza ordering pizzas: S. Sand S Input data set File format Each input data set is provided in a plain text file containing exclusively ASCII characters with lines terminated with a single 'n' character (UNIX-style line endings). When a single line contains multiple elements, they are separated by single spaces. Scoring The solution gets 1 point for each slice of pizza ordered. For example, above we ordered 3 pizzas: S, Sand S, We know that the pizza slices in each of these are 2.6, and 8 respectively. The first line of the data set contains the following data: an integer M (15 MS 107 - the maximum number of pizza slices to order an integer N (15 NS 10) - the number of different types of pizza The second line contains N integers - the number of slices in each type of pizza, in non-decreasing order: 1s5, sss ... SSM So the score is: 2+6+8 -16 points Note that there are multiple data sets representing separate instances of the problem. The final score for your team will be the sum of your best scores for the individual data sets. Example Input File 17 4 2568 Description 17 slices maximum, 4 different types of pizza type O has 2 slices, type 1 has 5. type 2 has 6. and type 3 has 8 slices S. (2 slices) S. (5 slices) S. (6 slices) S, 8 slices) Submissions Problem description You are organizing a Hash Code hub and want to order pizza for your hub's participants. Luckily, there is a nearby pizzeria with really good pizza. The pizzeria has different types of pizza, and to keep the food offering for your hub interesting, you can only order at most one pizza of each type. Fortunately, there are many types of pizza to choose from! File format The output should contain two lines The first line should contain a single integer K (OSKN) - the number of different types of pizza to order. The second line should contain K numbers - the types of pizza to order the types of pizza are numbered from 0 to N-1 in the order they are listed in the input) Each type of pizza has a specified size: the size is the number of slices in a pizza of this type. The total number of slices in the ordered pizzas must be less than or equal to M You estimated the maximum number of pizza slices that you want to order for your hub based on the number of registered participants. In order to reduce food waste, your goal is to order as many pizza slices as possible, but not more than the maximum number. Example Submission file 3 Description 3 types of pizza ordering pizzas: S. Sand S Input data set File format Each input data set is provided in a plain text file containing exclusively ASCII characters with lines terminated with a single 'n' character (UNIX-style line endings). When a single line contains multiple elements, they are separated by single spaces. Scoring The solution gets 1 point for each slice of pizza ordered. For example, above we ordered 3 pizzas: S, Sand S, We know that the pizza slices in each of these are 2.6, and 8 respectively. The first line of the data set contains the following data: an integer M (15 MS 107 - the maximum number of pizza slices to order an integer N (15 NS 10) - the number of different types of pizza The second line contains N integers - the number of slices in each type of pizza, in non-decreasing order: 1s5, sss ... SSM So the score is: 2+6+8 -16 points Note that there are multiple data sets representing separate instances of the problem. The final score for your team will be the sum of your best scores for the individual data sets. Example Input File 17 4 2568 Description 17 slices maximum, 4 different types of pizza type O has 2 slices, type 1 has 5. type 2 has 6. and type 3 has 8 slices S. (2 slices) S. (5 slices) S. (6 slices) S, 8 slices)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started