Given N integers in a sequence (refer to the input section for…

Question Answered step-by-step Given N integers in a sequence (refer to the input section for… Given N integers in a sequence (refer to the input section for format), you need to find the sub-sequence of integers such that it has the maximum length and the product of numbers in the sub-sequence is greater than 0. Print the length of the longest continuous sub-sequence and the product of the numbers present in the sub-sequence. If there are two sub-sequences of equal length print the one with the larger product of numbers in the sub-sequence.Input FormatInput consists of N integers in the form:Nx1 x2 … xNxi >= 0, 1 <= i <= NThe first line is the length of the sequence, the second line is the sequence (space-separated integers).Output FormatThe program should print the length of the longest sub-sequence and the product of the numbers in the sub-sequence[length_of_the_longest_sequence] [product_of_numbers]ExampleInput41 1 0 2Output2 1Explanation: The longest sub-sequence is of length 2 (1 1). The product of the sub-sequence is 1.Input30 3 2Output2 6Explanation: The longest sub-sequence whose product is greater than 0 is of length 2 (3 2). The product of numbers is 6. Computer Science Engineering & Technology C++ Programming CS MIT6 Share QuestionEmailCopy link Comments (0)