[Solution] Sort Zero Codeforces Solution
C. Sort Zero
time limit per test
1 secondmemory limit per test
256 megabytesinput
standard inputoutput
standard outputYou are given an array of
positive integers .
In one operation you do the following:
- Choose any integer .
- For all such that , do (assign to ).
Find the minimum number of operations required to sort the array in non-decreasing order.
Input
Each test contains multiple test cases. The first line contains the number of test cases ().
👇👇👇👇👇
Description of the test cases follows.
The first line of each test case contains a single integer ().
The second line of each test case contains positive integers ().
It is guaranteed that the sum of over all test cases does not exceed .
Output
For each test case print one integer — the minimum number of operations required to sort the array in non-decreasing order.
No comments:
Post a Comment