Last active
August 29, 2015 14:27
-
-
Save ch-hristov/2b6c79e936cffbc1308f to your computer and use it in GitHub Desktop.
easy dp1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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