Number of arrays
Practice
2.2 (48 votes)
Basic programming
Basics of implementation
Easy
Hiring
Implementation
Problem
67% Success 11672 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code
You are given an array A. You need to divide this array into exactly K non-empty segments and check whether the minimum element S amongst the maximum elements amongst all segments is less than Q or not.
In other words, if we store the maximum element of each of the segment in an array P, then you have to check if minimum element in P is less than Q or not.
Input:
- First line of input contains number of testcases, T
- First line of each testcase contains three integers: N denoting number of elements in array A, K denoting number of segments and Q.
- Second line of each testcase contains N space-separated integers, \(A_{1}\) , \(A_{2}\), ... \(A_{n}\).
Output:
- For each testcase, if S is less than Q, print S, else print \("NO"\) (without quotes).
- Answer for each test case should come in a new line.
Constraints:
- \( 1 \le T \le 10 \)
- \( 1 \le N \le10^{5} \)
- \( 1 \le K \le N \)
- \( 0 \le Q \le 10^{9} \)
- \( 1 \le A_{i} \le 10^{9} \)
Submissions
Please login to view your submissions
Similar Problems
Points:20
25 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyImplementation
Points:20
38 votes
Tags:
ApprovedEasyGeometryMathOpen
Points:20
29 votes
Tags:
Basic Programming
Editorial