Chef has an array A consisting of N positive integers. This is a base array. 2 Chef has an array B consisting of N positive integers. He placed this array directly above the array A. Imagine that...

ing of N positive inte his is array. onsisting of N positive {utd!kcs. »p placed ti nruy directly m, that number Bi is directly a e number Al initially. t Bi falls op Ai, Ai gets increased by Bi. | - Bi can be dropped by Chef on either Ai-1, Ai or Ai+l. drop element out of array (for example he can't drop B8 on A-1). e all the elements of array A to become equal, and looking for the biggest possible value he.
Chef has an array A consisting of N positive integers. This is a base array.<br>2 Chef has an array B consisting of N positive integers. He placed this array directly above the array A. Imagine that array B is falling<br>on array A, such that number Bi is directly above the number Ai initially.<br>4<br>If element Bi falls on Ai, Ai gets increased by Bi.<br>Each element Bi can be dropped by Chef on either Ai-1, Ai or Ai+1.<br>Chef can't drop element out of array (for example he can't drop B0 on A-1).<br>Chef wants all the elements of array A to become equal, and looking for the biggest possible value he can get.<br>8 Input:<br>5<br>10 1<br>11 10<br>12 20<br>13 4<br>14 15 7 10 10<br>15 6 14 21 1<br>16 3<br>17 1 100 3<br>18 1 2 3<br>19<br>20 Output:<br>21 30<br>22 21<br>-1<br>Plagiarism<br>Saved Notes<br>

Extracted text: Chef has an array A consisting of N positive integers. This is a base array. 2 Chef has an array B consisting of N positive integers. He placed this array directly above the array A. Imagine that array B is falling on array A, such that number Bi is directly above the number Ai initially. 4 If element Bi falls on Ai, Ai gets increased by Bi. Each element Bi can be dropped by Chef on either Ai-1, Ai or Ai+1. Chef can't drop element out of array (for example he can't drop B0 on A-1). Chef wants all the elements of array A to become equal, and looking for the biggest possible value he can get. 8 Input: 5 10 1 11 10 12 20 13 4 14 15 7 10 10 15 6 14 21 1 16 3 17 1 100 3 18 1 2 3 19 20 Output: 21 30 22 21 -1 Plagiarism Saved Notes

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here