Maximum Frequent Subarray Sum MFSS SOLUTION

Maximum Frequent Subarray Sum MFSS Akash has just learned the maximum subarray sum problem. And while thinking about the solution, he came up with a new problem, the maximum frequent subarray sum problem. In this problem, you will be given an array A of N integers. You have to choose a non-empty subarray with the … Read more


MathBuzz MAT There is an inter-city math competition among k various prestigious top schools in the city. Some subset of schools will be selected to compete, where the i-th school is selected with probability pi(mod998 244 353). The schools are all selected independently from each other. It’s even possible that the number of selected schools … Read more


Dual Distance DUALDIST Given a tree with N nodes, answer Q queries of the following type: a,b (where a≠b) which asks you to calculate ∑Ni=1min(dist(i,a),dist(i,b)) where dist(x,y) is the number of edges on the shortest path between the nodes x and y in the tree.Note: The input and output of this problem are large, so … Read more


Optimal Xor Set OPTSET Find K distinct numbers in the range [1,N] such that the bitwise XOR of all the numbers is maximized. Print any set of these numbers that maximize the XOR. InputThe first line contains an integer T, the number of test cases. Then the test cases follow.Each test case contains a single … Read more

Minimum Subtree Cover SUBTRCOV SOLUTION

Minimum Subtree Cover SUBTRCOV You are given a tree with n vertices (numbered 1,2,…,n) and an integer k. A subtree is defined as a connected subgraph of the tree. That is, a subtree is another tree that can be obtained by removing some (possibly none) vertices and all edges incident to those vertices from T. … Read more

Minimum Dual Area DAREA SOLUTION

Minimum Dual Area DAREA Given NN points in a 2D2D space, find the minimum sum of areas of rectangles required to cover all the points given that we can use at most 22 non-overlapping rectangles whose sides can touch. The rectangles must be axis-aligned, meaning the sides are vertical and horizontal. Input The first line contains an integer TT, the number of … Read more


Shortest Route SHROUTE There are N cities in Chefland numbered from 1 to N and every city has a railway station. Some cities have a train and each city has at most one train originating from it. The trains are represented by an array A, where Ai=0 means the i-th city doesn’t have any train … Read more


Bitwise Tuples BITTUP Chef has two numbers N and M. Help Chef to find number of integer N-tuples (A1,A2,…,AN) such that 0≤A1,A2,…,AN≤2M−1 and A1&A2&…&AN=0, where & denotes the bitwise AND operator. Since the number of tuples can be large, output it modulo 109+7. InputThe first line contains a single integer T denoting the number of … Read more


Bella ciao CHFHEIST Chef is planning a heist in the reserve bank of Chefland. They are planning to hijack the bank for D days and print the money. The initial rate of printing the currency is P dollars per day and they increase the production by Q dollars after every interval of d days. For … Read more


Summer Heat COCONUT Chefland has 2 different types of coconut, type A and type B. Type A contains only xa milliliters of coconut water and type B contains only xb grams of coconut pulp. Chef’s nutritionist has advised him to consume Xa milliliters of coconut water and Xb grams of coconut pulp every week in … Read more

error: Content is protected !!
Free Udemy Courses and Hacking Resources Join Us on TelegramClick Here