Problem - 1554A - Codeforces
You are given n π integers a 1 , a 2 ,β¦, a n π 1 , π 2 , β¦ , π π . Find the maximum value of max( a l , a l+1 ,β¦, a r )β min( a l , a l+1 ,β¦, a r ) π π π₯ ( π π , π π + 1 , β¦ , π π ) β π π π ( π π , π π + 1 , β¦ , π π ) over all pairs (l,r) ( π , π ) of integers for which 1β€l<rβ€n 1 β€ π < π β€ π . The first line contains a single integer t π‘ ( 1β€tβ€10000 1 β€ π‘ β€ 10 000 ) Β β the number of test cases. The first line of each test case contains a single integer n π ( 2β€nβ€ 10 5 2 β€ π β€ 10 5 ). The second line of each test case contains n π integers a 1 , a 2 ,β¦, a n π 1 , π 2 , β¦ , π π ( 1β€ a i β€ 10 6 1 β€ π π β€ 10 6 ). It is guaranteed that the sum of n π over all test cases doesn't exceed 3β 10 5 3 β 10 5 . For each test case, print a single integer Β β the maximum possible value of the product from the statement. Let f(l,r)=max( a l , a l+1 ,β¦, a r )β min( a l , a l+1 ,β¦, a r ) π ( π , π ) = π π π₯ ( π π , π π + 1 , β¦ , π π )