WA for subtask 1 but CA for Subtask 2 .
Why so? Can’t find error.
The task was to check if the given array can be arranged in strictly increasing order upto P elements and strictly decreasing upto n-p+1 elements. If yes then o/p any one of the soln otherwise No.
I stored count of every element . If max no. Count was >1 or any other no. Count was >2 … o/p will be -1 .
Otherwise … I set 2 vectors v1, V2 .
If count is 1 . Element will be added to v1 else to v2.
Sorted v1 in incresing order and v2 in decreasing and printed them.