-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminormax.cpp
More file actions
36 lines (36 loc) · 753 Bytes
/
minormax.cpp
File metadata and controls
36 lines (36 loc) · 753 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
#include <bits/stdc++.h>
using namespace std;
int main()
{
// your code goes here
// ia_anuj_10
int z;
cin >> z;
while (z--)
{
int t;
cin >> t;
vector<int> arr(t);
for (int j = 0; j < t; j++)
cin >> arr[j];
int low = arr[0], high = arr[0];
int post = 0;
for (int j = 1; j < t; j++)
{
if (arr[j] > low && arr[j] < high)
{
post = 1;
break;
}
low = min(low, arr[j]);
high = max(high, arr[j]);
}
if (post == 1)
cout << "no"
<< "\n";
else
cout << "yes"
<< "\n";
}
return 0;
}