Triplets Min CodeChef Solution July 2023
Problem
You are given an integer array of size .
A triplet array is defined as the collection of for all triplets , where .
You are given queries of the following type:
- Given an integer , return the value of smallest element in the triplet array.
Input Format
- The first line of input will contain a single integer , denoting the number of test cases.
- Each test case consists of multiple lines of input.
- The first line of each test case contains two space-separated integers and — the size of array and the number of queries, respectively.
- The second line of each test case contains space-separated integers .
- The following lines describe the queries. Each of these lines contain a single positive integer .
Output Format
For each query, print a single line containing the smallest element in the triplet array.
Explanation:
Test case 1: Here, all elements of triplet array are equal to .
Test case 2: The sorted triplet array is .
No comments:
Post a Comment