cf702A Maximum Increase

时间:2023-03-09 00:39:22
cf702A Maximum Increase
A. Maximum Increase
time limit per test 1 second
memory limit per test 256 megabytes
input standard input
output standard output

You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.

A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.

Input

The first line contains single positive integer n (1 ≤ n ≤ 105) — the number of integers.

The second line contains n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109).

Output

Print the maximum length of an increasing subarray of the given array.

Examples
input
5
1 7 2 11 15
output
3
input
6
100 100 100 100 100 100
output
1
input
3
1 2 3
output
3

求出最长上升子串长度

真是逗逼。。写了<和>的情况忘记搞=了

然后被x。。

幸好不记分

哎毕竟是老了

 #include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<ctime>
#define LL long long
#define inf 0x7ffffff
#define pa pair<int,int>
#define pi 3.1415926535897932384626433832795028841971
using namespace std;
inline LL read()
{
LL x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
inline void write(LL a)
{
if (a<){printf("-");a=-a;}
if (a>=)write(a/);
putchar(a%+'');
}
inline void writeln(LL a){write(a);printf("\n");}
int n,x,tot,ans;
int a[];
int main()
{
n=read();
for(int i=;i<=n;i++)a[i]=read();
x=a[];tot=;ans=;
for (int i=;i<=n;i++)
{
if (a[i]>x)x=a[i],tot++;
else if (a[i]<=x)x=a[i],tot=;
ans=max(ans,tot);
}
printf("%d\n",ans);
}

cf702A