GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Tuesday, 14 June 2022

[Solution] 2^Sort Codeforces Solution | Codeforces Problem Solution 2022

G. 2^Sort
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Given an array a of length n and an integer k, find the number of indices 1ink such that the subarray [ai,,ai+k] with length k+1 (not with length k) has the following property:

  • If you multiply the first element by 20, the second element by 21, ..., and the (k+1)-st element by 2k, then this subarray is sorted in strictly increasing order.
More formally, count the number of indices 1ink such that

Input

The first line contains an integer t (1t1000) — the number of test cases.

Solution Click Below:-  CLICK HERE

The first line of each test case contains two integers nk (3n21051k<n) — the length of the array and the number of inequalities.

The second line of each test case contains n integers a1,a2,,an (1ai109) — the elements of the array.

The sum of n across all test cases does not exceed 2105.

Output

For each test case, output a single integer — the number of indices satisfying the condition in the statement.

No comments:

Post a Comment