Educational Codeforces Round 15 A dp

时间:2021-09-27 04:59:56
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

题意:连续的最长上升子序列的长度
题解:dp[i]表示以a[i]结尾的 连续的最长上升子序列的长度
 /******************************
code by drizzle
blog: www.cnblogs.com/hsd-/
^ ^ ^ ^
O O
******************************/
//#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<map>
#include<algorithm>
#include<queue>
#include<cmath>
#define ll __int64
#define PI acos(-1.0)
#define mod 1000000007
using namespace std;
int n;
int a[];
int dp[];
int ans=;
int main()
{
scanf("%d",&n);
int ans=;
for(int i=;i<=n;i++)
scanf("%d",&a[i]);
dp[]=;
ans=;
for(int i=;i<=n;i++)
{
if(a[i]>a[i-])
{
dp[i]=dp[i-]+;
ans=max(ans,dp[i]);
}
else
dp[i]=;
}
cout<<ans<<endl;
return ;
}