-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCPP0216.cpp
More file actions
46 lines (44 loc) · 965 Bytes
/
CPP0216.cpp
File metadata and controls
46 lines (44 loc) · 965 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <bits/stdc++.h>
#define MAX 10000001
#define ll long long
#define fastsync() \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
const int mod = 1e9 + 7;
using namespace std;
bool check(int a[], int l, int r) {
int check = -1;
for (int i = l; i < r; i++) {
if (a[i] > a[i + 1]) {
check = i;
break;
}
}
if (check != -1) {
for (int i = check; i < r; i++) {
if (a[i] < a[i + 1])
return 0;
}
}
return 1;
}
int main() {
fastsync();
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
int a[n];
for (int &x : a)
cin >> x;
int l, r;
cin >> l >> r;
if (check(a, l, r))
cout << "Yes\n";
else
cout << "No\n";
}
return 0;
}