Rezultati

Up. imeNalogaJezikRezultatČas oddaje
EOF-2017 Škatle C++ 100/100OK 20. apr '17 @ 19:19

Test Točke Porabljen spomin Porabljen čas Status
#1 6/6 3,102 MiB 0,004 s OK
#2 6/6 3,102 MiB 0,004 s OK
#3 6/6 3,074 MiB 0,004 s OK
#4 6/6 3,070 MiB 0,004 s OK
#5 6/6 3,043 MiB 0,004 s OK
#6 7/7 3,074 MiB 0,004 s OK
#7 7/7 3,074 MiB 0,004 s OK
#8 7/7 3,070 MiB 0,004 s OK
#9 7/7 3,074 MiB 0,004 s OK
#10 7/7 3,074 MiB 0,004 s OK
#11 7/7 3,105 MiB 0,004 s OK
#12 7/7 3,078 MiB 0,004 s OK
#13 7/7 3,078 MiB 0,004 s OK
#14 7/7 3,074 MiB 0,004 s OK
#15 7/7 3,074 MiB 0,004 s OK

Ocenjevani program (Skatle.cpp):
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
struct str{
	int x[10];
}skatla[101];


int N, D;
int dp[105];


bool f(str a, str b){
	for(int i=0; i<D; i++){
		if(a.x[i] != b.x[i]) return (a.x[i] > b.x[i]);
	}
	return true;
}

bool allsmaller(str a, str b){
	for(int i=0; i<D; i++){
		if(a.x[i] <= b.x[i]) return false;
	}
	return true;
}

int main(){
	cin>>N>>D;
	
	for(int n=0; n<N; n++){
		for(int d=0; d<D; d++){
			cin>>skatla[n].x[d];
		}
		sort(skatla[n].x, skatla[n].x+D);
	}	

	sort(skatla, skatla + N, f);
/*	for(int n=0; n<N; n++){
		for(int iii=0; iii<D; iii++){
			cout<<skatla[n].x[iii]<<' ';
		}
		cout<<endl;
	}*/

	for(int i = 0; i<N; i++){
		dp[i] = 1;
		for(int j = i-1; j>=0; j--){
			if(allsmaller(skatla[j], skatla[i])){
				dp[i] = max(dp[i], dp[j] + 1);
			}
		}	
	}
	
//	cout<<endl<<endl;
//	for(int i=0; i<N; i++) cout<<dp[i]<<' ';
//	cout<<endl;
	
	int maxi = 0;
	for(int i=0; i<100; i++) maxi = max(dp[i], maxi);
	cout<<maxi;
	return 0;
}