Question
Somewhere near the town, a number of frogs are standing on a number of lotus leaves. As they are social animals, the frogs would like
Somewhere near the town, a number of frogs are standing on a number of lotus leaves. As they are social animals, the frogs would like to gather together, all on the same lotus leaf. The frogs do not want to get wet, so they have to use their limited jump distance d to get together by jumping from piece to piece. However, these lotus leaves just started to grow, they will get damaged further by the force needed to jump to another leaf. Fortunately, the frogs are real experts on leaves, and 2 know exactly how many times a frog can jump off each leaf before it sinks and become unavailable. Landing on leaves does not damage it. You have to help the frogs find a leaf where they can meet.
In this question, we will get the position of N lotus leaves. For each i ∈ [N], we know its position (xi , yi), the number of frogs ni on that leaf and the number of jumps mi before it sinks. The distance between two leaves (xi , yi) and (xj , yj ) is defined as |xi − xj | + |yi − yj |. Design a polynomial algorithm to determine whether whether each lotus leaf can hold all frogs for a party. The output is an array with length N, containing yes/no solution. Prove the correctness of your algorithm.
Step by Step Solution
3.38 Rating (157 Votes )
There are 3 Steps involved in it
Step: 1
Answer Inswers To have a Population mean of length Ho M 11 ...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