Number Theory and Binary Search
Description
- Topics : Number Theory, Binary Search
- Link to the contest
Editorial
caution
Donβt read the editorial, if you have not attempted or read the problems. It would hamper your thinking capability, if you do so.
Find mod m
A.- Problem
- Editorial
- Code
Given 3 positive integers - , and . Find value of mod .
The function is defined as the product of square of primes up to (inclusive).
For eg. .
Constraints
Simple Maths
B.- Problem
- Editorial
- Code
You will be given 5 number , , , , . You will make 3 more numbers , , from it.
You task is to computer % where
Note :
Constraints
Candy Distribution
C.- Problem
- Editorial
- Code
In the Town of Candyland, there are candy vendors who need to distribute candies to the kids of the town. Candyland can be represented as the x-axis where kids are standing at different coordinates, which are given to you. A vendor can only serve kids which are in his range, for example, if a vendor is placed at and his range is then all kids in the range can get candies from him. All the vendors have an equal range .
Since the vendors are lazy so they want you to find the minimum range such that all the kids in Candyland can get candies.
Constraints
Seems to be easy xD
D.- Problem
- Editorial
- Code
Given an array (having the values of all elements in range [0,2000] ) of length .
Each index has an initial weight of units. You have to perform queries. The queries can be of 2 types:
Type :
Type :
Type queries ask you to increase the weight of all indices by units.
Type queries ask you to calculate the total weight contributed by elements having value in the index range
Constraints
Rahul and his set
E.- Problem
- Editorial
- Code
Rahul has a set consisting of the first natural numbers.
He thinks that 'wellness' of a subset β is equal to the maximum of over all pairs such that both and are in and .
Rahul is an organized guy and for each β {} he wants to find a subset that has the smallest wellness among all subsets in of size . There can be more than one subset with the smallest wellness and the same size, but you don't need to worry about it. Rahul wants to find all the subsets himself, but he needs your help to find the smallest possible wellness for each size , will name it .
Please, help Rahul to find .
Constraints