Skip to main content

Posts

Showing posts with the label codeforces

Maximum Product Codeforces Problems solution

  Maximum Product Codeforces Problems solution  Problems statement- You are given an array of integers  a 1 , a 2 , … , a n a 1 , a 2 , … , a n . Find the maximum possible value of  a i a j a k a l a t a i a j a k a l a t  among all five indices  ( i , j , k , l , t ) ( i , j , k , l , t )  ( i < j < k < l < t i < j < k < l < t ). Input The input consists of multiple test cases. The first line contains an integer  t t  ( 1 ≤ t ≤ 2 ⋅ 10 4 1 ≤ t ≤ 2 ⋅ 10 4 ) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer  n n  ( 5 ≤ n ≤ 10 5 5 ≤ n ≤ 10 5 ) — the size of the array. The second line of each test case contains  n n  integers  a 1 , a 2 , … , a n a 1 , a 2 , … , a n  ( − 3 × 10 3 ≤ a i ≤ 3 × 10 3 − 3 × 10 3 ≤ a i ≤ 3 × 10 3 ) — given array. It's guaranteed that the sum of  n n  over all test cases does not exceed  2 ⋅ 10 5 2 ⋅ 10 5 . Output For each test case, print one integer — the