Q} Code the given problem using python programming language Sereja has an array consisting of n integers a1 a; +1, a; +1 + d> a; +2, · . ., ak-1+ d> ak, ak t (if it exists). Help Sereja find the...


Q} Code the given problem using python programming language<br>Sereja has an array consisting of n integers a1 <a2 < ...< an. Based on this<br>array, he has to answer m queries represented by pairs integers t and d.<br>The answer for a query is the smallest integer i for which there exist some k (<br>i < k) such that a; + d > a; +1, a; +1 + d> a; +2, · . ., ak-1+ d> ak,<br>ak <t and ar+1 >t (if it exists).<br>Help Sereja find the answer for each query.<br>Input:<br>123 10 50<br>1<br>117<br>Output:<br>1<br>

Extracted text: Q} Code the given problem using python programming language Sereja has an array consisting of n integers a1 <>< an.="" based="" on="" this="" array,="" he="" has="" to="" answer="" m="" queries="" represented="" by="" pairs="" integers="" t="" and="" d.="" the="" answer="" for="" a="" query="" is="" the="" smallest="" integer="" i="" for="" which="" there="" exist="" some="" k="" (="" i="">< k)="" such="" that="" a;="" +="" d=""> a; +1, a; +1 + d> a; +2, · . ., ak-1+ d> ak, ak t (if it exists). Help Sereja find the answer for each query. Input: 123 10 50 1 117 Output: 1

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here