It's final exam week of Jack's cooking class. His class of N students are busy studying for it. Unfortunately, being crammers, each student is only able to study one topic. The i-th student studied...


It's final exam week of Jack's cooking class. His class of N students are busy<br>studying for it. Unfortunately, being crammers, each student is only able to study<br>one topic. The i-th student studied topic S. Topics are numbered 1 to 106. Jack<br>prepared N tasks for exam. He intends to assign each task to exactly one student.<br>Each task requires exactly one topic to pass. The j-th task requires topic Tj. Tom is a<br>sadistic teacher; he doesn't want the students to pass! Therefore, he wants to<br>assign the tasks in such that the number of students assigned to the topic he/she<br>studied for is minimized. Can you please help Jack in developing a C++ code to<br>find any such assignment? If there are multiple possible assignments, you may<br>output anyone.<br>Input:<br>1<br>100 100 200<br>100 100 200<br>Output:<br>1<br>321<br>

Extracted text: It's final exam week of Jack's cooking class. His class of N students are busy studying for it. Unfortunately, being crammers, each student is only able to study one topic. The i-th student studied topic S. Topics are numbered 1 to 106. Jack prepared N tasks for exam. He intends to assign each task to exactly one student. Each task requires exactly one topic to pass. The j-th task requires topic Tj. Tom is a sadistic teacher; he doesn't want the students to pass! Therefore, he wants to assign the tasks in such that the number of students assigned to the topic he/she studied for is minimized. Can you please help Jack in developing a C++ code to find any such assignment? If there are multiple possible assignments, you may output anyone. Input: 1 100 100 200 100 100 200 Output: 1 321

Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here