Cod sursa(job #1486497)

Utilizator RusuAlexeiRusu Alexei RusuAlexei Data 14 septembrie 2015 22:52:23
Problema Subsir crescator maximal Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.62 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];
		}
	}*/
	int i;
	for (i=1; minLastForThisLength[i+1]!=200000; i++);
	printf("%d\n", i);
	for (i=1; minLastForThisLength[i]!=200000; i++) printf("%d ", minLastForThisLength[i]);
	
	return 0;
}