Cod sursa(job #1486499)

Utilizator RusuAlexeiRusu Alexei RusuAlexei Data 14 septembrie 2015 22:55:21
Problema Subsir crescator maximal Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.45 kb
#include <stdio.h>

int n;
int a[100000];
int minLastForThisLength[100002];

int main(void){
	
	scanf("%d", &n);
	for (int i=0; i<n; i++){
		scanf("%d", &a[i]);
	}

	minLastForThisLength[0] = 0;
	for (int i=1; i<=n; i++) minLastForThisLength[i] = 200000;
	for (int i=0; i<n; i++){
		for (int j=1; j<=n; j++){
			if (minLastForThisLength[j-1]<a[i] && minLastForThisLength[j]>a[i]) minLastForThisLength[j] = a[i];
		}
	}
	
	return 0;
}