Codeforces Round 258 (Div. 2)
B
Sort the Array
Codeforces
1300
原题
← AC →
翻译中…

Being a programmer, you like arrays a lot. For your birthday, your friends have given you an array $*a*$ consisting of $*n*$ distinct integers.

翻译中…

Unfortunately, the size of $*a*$ is too small. You want a bigger array! Your friends agree to give you a bigger array, but only if you are able to answer the following question correctly: is it possible to sort the array $*a*$ (in increasing order) by reversing exactly one segment of $*a*$? See definitions of segment and reversing in the notes.

翻译中…

Input

翻译中…

The first line of the input contains an integer $*n*$ ($1 ≤ *n* ≤ 10^{5}$) — the size of array $*a*$.

翻译中…

The second line contains $*n*$ distinct space-separated integers: $*a*[1], *a*[2], ..., *a*[*n*]$ ($1 ≤ *a*[*i*] ≤ 10^{9}$).

翻译中…

Output

翻译中…

Print "yes" or "no" (without quotes), depending on the answer.

翻译中…

If your answer is "yes", then also print two space-separated integers denoting start and end (start must not be greater than end) indices of the segment to be reversed. If there are multiple ways of selecting these indices, print any of them.

翻译中…

Note

翻译中…

Sample 1. You can reverse the entire array to get $[1, 2, 3]$, which is sorted.

翻译中…

Sample 3. No segment can be reversed such that the array will be sorted.

翻译中…

Definitions

翻译中…

A segment $[*l*, *r*]$ of array $*a*$ is the sequence $*a*[*l*], *a*[*l* + 1], ..., *a*[*r*]$.

翻译中…

If you have an array $*a*$ of size $*n*$ and you reverse its segment $[*l*, *r*]$, the array will become:

翻译中…

$*a*[1], *a*[2], ..., *a*[*l* - 2], *a*[*l* - 1], *a*[*r*], *a*[*r* - 1], ..., *a*[*l* + 1], *a*[*l*], *a*[*r* + 1], *a*[*r* + 2], ..., *a*[*n* - 1], *a*[*n*].$

翻译中…

样例

Input #1
3
3 2 1
Output #1
yes
1 3
InputCopy OutputCopy
Input #2
4
2 1 3 4
Output #2
yes
1 2
InputCopy OutputCopy
Input #3
4
3 1 2 4
Output #3
no
InputCopy OutputCopy
Input #4
2
1 2
Output #4
yes
1 1
InputCopy OutputCopy
题目信息
题号
451B
时间限制
1 s
内存限制
256 MB
标签
模拟
排序

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。