Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You are given an array of N positive integers ( A 1 , A 2 , A 3 , dots, A N ) and an
You are given an array of positive integers dots, and an integer You are required to support queries of the following types:
: Your task is to add the value to all the array elements in subarray
: Your task is to print the minimum number of array elements that must be removed from subarray so that all the remaining elements in the subarray have the same remainder when divided by
A subarray is an array composed of a contiguous block of the original array elements. For example, all the subarrays of the array are and
Note
You are allowed to remove no elements.
The array remains the same after solving the second query, that is the array elements are not removed after each operation that is given in the second query.
There is at least one query of the second type.
Input format
The first line contains three spaceseparated integers and
The second line contains spaceseparated integers denoting the array elements.
Each of the next lines contains one of the defined queries.
Output format
For each query of the second type, print a single integer denoting the answer for that query.
Constraints
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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