题目链接:http://codeforces.com/contest/451/problem/B
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn=1e5+5;
int a[maxn];
int b[maxn];
int main()
{
int m,j,k;
while(cin>>m)
{
j=k=0;
for(int i=0; i<m; i++)
cin>>a[i],b[i]=a[i];
sort(b,b+m);
for(int i=0; i<m; i++)
if(b[i]!=a[i])
{
j=i;
break;
}
for(int i=m-1; i>=0; i--)
if(b[i]!=a[i])
{
k=i;
break;
}
int sum=0;
for(int i=j; i<=k; i++)
{
if(a[i]==b[k-i+j])
sum++;
}
//cout<<j<<" "<<k<<" "<<sum<<endl;
if(sum == (k-j+1))
puts("yes"),cout<<j+1<<" "<<k+1<<endl;
else
puts("no");
}
return 0;
}