File tree 1 file changed +68
-0
lines changed
1 file changed +68
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < iostream>
2
+ #include < cmath>
3
+ #include < cstring>
4
+ #include < set>
5
+ #include < vector>
6
+ #include < map>
7
+ #include < algorithm>
8
+ #include < sstream>
9
+ #include < climits>
10
+ #include < utility>
11
+ #include < conio.h>
12
+
13
+ #define MX 100000
14
+ #define fs first
15
+ #define sec second
16
+ #define vi vector<int >
17
+ #define pi pair<int , int >
18
+ #define TC int T;cin>>T;while (T--)
19
+ #define loop (i,a,c ) for (int i=0 ;i<a;i++)
20
+ #define loop1 (i,a,c ) for (int i=1 ;i<=a;i++)
21
+ #define pb (a ) push_back(a)
22
+ #define all (a ) (a).begin(), (a).end()
23
+ #define mp (x, y ) make_pair((x), (y))
24
+ #define ll long long int
25
+ #define iter (c ) typeof(c.begin())
26
+ #define foreach (it, c ) for (iter(c) it = c.begin(); it != c.end(); it++)
27
+ using namespace std ;
28
+ int main (){
29
+ int t;
30
+ cin>>t;
31
+ int arr[t];
32
+
33
+
34
+ for (int i=0 ;i<t;i++){
35
+ cin>>arr[i];
36
+ }
37
+ if (t==1 )
38
+ cout<<" YES" <<endl;
39
+
40
+ else {
41
+ int count=0 ;
42
+ int flag=0 ;
43
+ int i;
44
+ for (i=0 ;i<t-1 ;i++)
45
+ {
46
+ if (arr[i]<arr[i+1 ])count++;
47
+ else break ;
48
+ // cout<<count;
49
+
50
+ }
51
+ int j;
52
+ for (j=i;j<t-1 ;j++){
53
+ if (arr[j]==arr[j+1 ])count++;
54
+ else break ;
55
+ }
56
+ for (i=j;i<t-1 ;i++){
57
+ if (arr[i]>arr[i+1 ])count++;
58
+ else break ;
59
+
60
+ }
61
+ if (count==t-1 )cout<<" YES" <<endl;
62
+ else cout<<" NO" <<endl;
63
+
64
+ }
65
+
66
+ getch ();
67
+ return 0 ;
68
+ }
You can’t perform that action at this time.
0 commit comments