#C8353. Taco: Making Strictly Increasing Sequence
Taco: Making Strictly Increasing Sequence
Taco: Making Strictly Increasing Sequence
You are given an integer sequence of length \(n\) and a non-negative integer \(k\) representing the maximum number of operations allowed. In one operation, you can add 1 to any element of the sequence. Your task is to determine whether it is possible to make the sequence strictly increasing by performing at most \(k\) operations.
A sequence \(a_1, a_2, \dots, a_n\) is strictly increasing if and only if \(a_1 < a_2 < \dots a_{i-1}\).
Determine if the total number of increments needed does not exceed \(k\). If it is possible, print YES
; otherwise, print NO
.
inputFormat
The first line contains an integer \(T\) (the number of test cases). The description of the test cases follows.
For each test case:
- The first line contains two integers \(n\) and \(k\) separated by a space.
- The second line contains \(n\) integers, representing the elements of the sequence.
outputFormat
For each test case, output a single line containing YES
if it is possible to transform the sequence into a strictly increasing sequence with at most \(k\) operations, or NO
otherwise.
5
5 3
1 2 2 3 4
4 1
1 3 2 4
4 0
1 2 3 4
3 1000
1000000000 1000000000 1000000000
6 5
1 2 1 2 1 2
YES
NO
YES
YES
NO
</p>