GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Monday 27 June 2022

[Solution] Maximum Product? Codeforces Solution | Codeforces Problem Solution 2022



H. Maximum Product?
time limit per test
1.5 seconds
memory limit per test
512 megabytes
input
standard input
output
standard output

You are given a positive integer k. For a multiset of integers S, define f(S) as the following.

  • If the number of elements in S is less than kf(S)=0.
  • Otherwise, define f(S) as the maximum product you can get by choosing exactly k integers from S.

More formally, let |S| denote the number of elements in S. Then,

  • If |S|<kf(S)=0.
  • Otherwise, f(S)=maxTS,|T|=k(iTi).

You are given a multiset of integers, A. Compute BAf(B) modulo 109+7.

Note that in this problem, we distinguish the elements by indices instead of values. That is, a multiset consisting of n elements always has 2n distinct subsets regardless of whether some of its elements are

Solution Click Below:-  👉CLICK HERE👈
👇👇👇👇👇

 equal.

Input

The first line of input contains two integers n and k, where n is the number of elements in A (1kn600).

The second line of input contains n integers a1,a2,,an, describing the elements in A (109ai109).

Output

Output BAf(B) modulo 109+7.

No comments:

Post a Comment