There is an exhibit a1,a2,… ,an of n positive integers. You should isolate it into a negligible number of nonstop sections, with the end goal that in each fragment there are no two numbers (on various positions), whose item is an ideal square. Also, it is permitted to do all things considered k such tasks before the division: pick a number in the cluster and change its worth to
Correct answer will be upvoted else downvoted. Computer science.
There is an exhibit a1,a2,… ,an of n positive integers. You should isolate it into a negligible number of nonstop sections, with the end goal that in each fragment there are no two numbers (on various positions), whose item is an ideal square.
Also, it is permitted to do all things considered k such tasks before the division: pick a number in the cluster and change its worth to any certain integer.
What is the base number of nonstop fragments you should utilize in the event that you will make changes ideally?
Input
The main line contains a solitary integer t (1≤t≤1000) — the number of experiments.
The principal line of each experiment contains two integers n, k (1≤n≤2⋅105, 0≤k≤20).
The second line of each experiment contains n integers a1,a2,… ,an (1≤
It's dependable that the amount of n over all experiments doesn't surpass 2⋅105.
Output
For each experiment print a solitary integer — the response to the issue.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images