cswork / OAOpen practice workspace

Capital OneOA #14

Cyclic Shift to Strictly Descending Array

Estimated EasyJudge-ready

Topics (AI-labelled)In-place Arrays

Given an integer array nums and the right-rotation amount t for this run, move the last t elements to the front of the array once and determine whether the result is strictly decreasing. t is a given input value and does not need to be chosen.

Input

The first line contains n (this site adopts the source's suggested range 1≤n≤200000), the second line contains n integers nums[i] (this site adopts the source's suggested range |nums[i]|≤10^9), and the third line contains t (this site adopts the source's suggested range 0≤t<n).

Output

Output true or false.

Example 1

Input:

3
3 2 1
0

Output:

true

Example 2

Input:

3
1 3 2
1

Output:

false

Example 3

Input:

3
2 1 3
2

Output:

false

Editorial

Loading solution…