

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
In this problem, you are given the information about various ice floes in the antarctic region, including their locations, number of penguins present, and the maximum number of times a penguin can jump off each floe before it disappears. Your task is to help the penguins find ice floes where they can all meet without getting wet or damaging the floes. Use the given input to determine the indices of the ice pieces where all penguins can meet.
Typology: Lecture notes
1 / 2
This page cannot be seen from the preview
Don't miss anything!


A sample layout of ice oes with 3 penguins on them.
Somewhere near the south pole, a number of penguins are stand- ing on a number of ice oes. Being social animals, the penguins would like to get together, all on the same oe. The penguins do not want to get wet, so they have use their limited jump distance to get together by jumping from piece to piece. However, tem- peratures have been high lately, and the oes are showing cracks, and they get damaged further by the force needed to jump to an- other oe. Fortunately the penguins are real experts on cracking ice oes, and know exactly how many times a penguin can jump off each oe before it disintegrates and disappears. Landing on an ice oe does not damage it. You have to help the penguins nd all oes where they can meet.
On the rst line one positive number: the number of testcases, at most 100. After that per testcase:
Per testcase:
Universidad de Valladolid OJ: 12125 – March of the Penguins 2/