[Solution] LIS or Reverse LIS? Codeforces Solution | Codeforces Problem Solution 2022
You are given an array of positive integers.
Let denote the length of longest strictly increasing subsequence of . For example,
- = .
- = .
- = .
We define array as the array obtained after reversing the array i.e. .
The beauty of array is defined as .
The input consists of multiple test cases. The first line contains a single integer — the number of test cases. Description of the test cases follows.
The first line of each test case contains a single integer — the length of array .
The second line of each test case contains integers — the elements of the array .
It is guaranteed that the sum of over all test cases does not exceed .
For each test case, output a single integer — the maximum possible beauty of after rearranging its elements arbitrarily.
No comments:
Post a Comment