-
Notifications
You must be signed in to change notification settings - Fork 0
/
702A.cpp
53 lines (47 loc) · 934 Bytes
/
702A.cpp
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
47
48
49
50
51
52
53
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <sstream>
#include <deque>
#define ll long long
using namespace std;
const int maxn=1000000;
const ll mod=1000000007;
int a[maxn];
int trend[maxn];
int n;
int main(){
cin>>n;
memset(a,0,sizeof(a));
memset(trend,0,sizeof(trend));
for(int i=0;i<n;i++){
cin>>a[i];
}
for(int i=1;i<n;i++){
if(a[i]-a[i-1]>0){
trend[i]=1;
}else{
if(a[i]-a[i-1]<0){
trend[i]=-1;
}
}
}
int out=1;
int last=1;
for(int i=1;i<n;i++){
if(trend[i]==1){
out+=1;
}else{
last=max(last,out);
out=1;
}
}
last=max(last,out);
cout<<last;
return 0;
}