Skip to content

Instantly share code, notes, and snippets.

@ch-hristov
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ch-hristov/2b6c79e936cffbc1308f to your computer and use it in GitHub Desktop.
Save ch-hristov/2b6c79e936cffbc1308f to your computer and use it in GitHub Desktop.
easy dp1
//DP1
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int n;
cin >> n;
auto seq = new int[n + 1];
for (auto i = 1; i <= n; i++)
cin >> seq[i];
auto mem = new int[n + 1];
seq[0] = 999999999;
mem[0] = 0;
int max = -99999999;
for (int i = 1; i < n; i++){
if (seq[i - 1] < seq[i])
mem[i] = mem[i - 1] + 1;
else mem[i] = 1;
if (mem[i]>max)max = mem[i];
}
cout << max << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment