[Solution] Decinc Dividing Codeforces Solution | Codeforces Problem Solution 2022
F. Decinc Dividing
time limit per test
2 secondsmemory limit per test
256 megabytesinput
standard inputoutput
standard outputLet's call an array of integers Decinc if can be made increasing by removing a decreasing subsequence (possibly empty) from it.
- For example, if , we can remove the decreasing subsequence from and obtain , which is increasing.
You are given a permutation of numbers from to . Find the number of pairs of integers with such that (the subarray of from to ) is a Decinc array.
Input
The first line contains a single integer () — the size of .
Solution Click Below:- CLICK HERE
The second line contains integers (, all are distinct) — elements of the permutation.
Output
Output the number of pairs of integers such that (the subarray of from to ) is a Decinc array.
No comments:
Post a Comment