[Solution] Minimums and Maximums Codeforces Solution | Codeforces Problem Solution 2022
A. Minimums and Maximums
time limit per test
2 secondsmemory limit per test
512 megabytesinput
standard inputoutput
standard outputAn array is beautiful if both of the following two conditions meet:
- there are at least and at most elements in the array equal to its minimum;
- there are at least and at most elements in the array equal to its maximum.
For example, the array has elements equal to its minimum (-st, -rd and -th) and elements equal to its maximum (-th and -th).
Solution Click Below:- CLICK HERE
Another example: the array has elements equal to its minimum and elements equal to its maximum.
Your task is to calculate the minimum possible number of elements in a beautiful array.
Input
The first line contains one integer () — the number of test cases.
Each test case consists of one line containing four integers , , and (; ).
Output
For each test case, print one integer — the minimum possible number of elements in a beautiful array.
No comments:
Post a Comment