Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<list>
- #include<cstdio>
- #include<vector>
- #include<string>
- #include<algorithm>
- #include<queue>
- #include<cmath>
- #include<map>
- #pragma comment(linker, "/STACK:367772160")
- using namespace std;
- int a[11000];
- int tmp[11000];
- int main()
- {
- std::ios::sync_with_stdio(0);
- int n;
- int cnt = 0;
- int l = 1, r = 1;
- bool ok = true;
- cin >> n;
- for (int i = 1; i <= n; i++)
- {
- cin >> a[i];
- }
- a[0] = -1000000;
- a[n + 1] = 1000000;
- for (int i = 1; i <= n; i++)
- {
- if (a[i] > a[i + 1])
- {
- if (ok)
- {
- l = i;
- ok = false;
- cnt++;
- }
- }
- else
- {
- if (!ok) r = i;
- ok = true;
- }
- }
- if (cnt>1 || (cnt == 1 && (a[l - 1]>a[r] || a[l]>a[r + 1]))) cout << "no\n";
- else cout << "yes\n" << l << " " << r << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement